Package marauroa.common.crypto
Class RSAPublicKey
java.lang.Object
marauroa.common.crypto.RSAPublicKey
- Direct Known Subclasses:
RSAKey
Implementation of a RSA key.
- Author:
- quisar
-
Field Summary
Modifier and TypeFieldDescriptionstatic BigInteger
0static BigInteger
1static BigInteger
2static BigInteger
6protected BigInteger
eprotected BigInteger
n -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionencode(BigInteger message)
encodes a BigIntegerbyte[]
encodeByteArray(byte[] message)
encodes an arraygetE()
get egetN()
gets nstatic String
getString(BigInteger value)
converts a BigInteger into a stringstatic BigInteger
converts a string into a BigIntegervoid
print(PrintStream out)
prints the key to a streamvoid
print(PrintWriter out)
prints the key to a writerboolean
verifySignature(BigInteger message, BigInteger signature)
verifies a signature
-
Field Details
-
big0
0 -
big1
1 -
big2
2 -
big6
6 -
n
n -
e
e
-
-
Constructor Details
-
RSAPublicKey
creates a new RSAPublicKey object- Parameters:
n
- ne
- e
-
-
Method Details
-
print
prints the key to a writer- Parameters:
out
- writer to print to
-
print
prints the key to a stream- Parameters:
out
- stream to print to
-
getN
gets n- Returns:
- n
-
getE
get e- Returns:
- e
-
encode
encodes a BigInteger- Parameters:
message
- BigInteger- Returns:
- encoded BigInteger
-
encodeByteArray
public byte[] encodeByteArray(byte[] message)encodes an array- Parameters:
message
- array- Returns:
- encoded array
-
verifySignature
verifies a signature- Parameters:
message
- BigIntegersignature
- BigInteger- Returns:
- true, if the signature is correct; false otherwise
-
getValue
converts a string into a BigInteger- Parameters:
str
- to convert- Returns:
- BigInteger
-
getString
converts a BigInteger into a string- Parameters:
value
- BigInteger- Returns:
- String
-