Package marauroa.common.crypto
Class RSAKey
java.lang.Object
marauroa.common.crypto.RSAPublicKey
marauroa.common.crypto.RSAKey
Implementation of a private RSA Key
- Author:
- quisar
-
Field Summary
-
Constructor Summary
ConstructorDescriptionRSAKey(BigInteger n, BigInteger d, BigInteger e)
creates a new RSAKey object -
Method Summary
Modifier and TypeMethodDescriptiondecode(BigInteger message)
decodes a BigIntegerbyte[]
decodeByteArray(byte[] message)
decodes a byte arraystatic RSAKey
generateKey(int nbBits)
generates a key pairgetD()
gets dgets the public keyvoid
print(PrintStream out)
prints the key to a streamvoid
print(PrintWriter out)
prints the key to a writersign(BigInteger message)
signs a messageMethods inherited from class marauroa.common.crypto.RSAPublicKey
encode, encodeByteArray, getE, getN, getString, getValue, verifySignature
-
Constructor Details
-
RSAKey
creates a new RSAKey object- Parameters:
n
- nd
- de
- e
-
-
Method Details
-
print
Description copied from class:RSAPublicKey
prints the key to a writer- Overrides:
print
in classRSAPublicKey
- Parameters:
out
- writer to print to
-
print
Description copied from class:RSAPublicKey
prints the key to a stream- Overrides:
print
in classRSAPublicKey
- Parameters:
out
- stream to print to
-
generateKey
generates a key pair- Parameters:
nbBits
- size of the key- Returns:
- RSAKey
-
decode
decodes a BigInteger- Parameters:
message
- BigInteger- Returns:
- decoded BigInteger
-
decodeByteArray
public byte[] decodeByteArray(byte[] message)decodes a byte array- Parameters:
message
- array to decode- Returns:
- decoded array
-
sign
signs a message- Parameters:
message
- message to sign- Returns:
- signed message
-
getPublicKey
gets the public key- Returns:
- public key
-
getD
gets d- Returns:
- d
-