cryptix.provider.rsa
Class RawRSAPrivateKey
- CryptixRSAPrivateKey, PrivateKey, RSAFactors, RSAKey
public class RawRSAPrivateKey
A class representing a RAW-encoded RSA private key.
The encoding consists of the following, in order:
- the private exponent d,
- the first factor of the modulus, p,
- the second factor of the modulus, q,
- the coefficient q^-1 mod p.
Each integer is represented as follows:
Byte Length
offset (bytes) Meaning
0 2 The length in bits of this BigInteger (MSB first);
2 variable The BigInteger's magnitude with no leading zeroes,
again MSB first.
Copyright © 1997
Systemics Ltd on behalf of the
Cryptix Development Team.
All rights reserved.
$Revision: 1.7 $
- Raif S. Naffah
- David Hopwood
- Cryptix 2.2.2
RawRSAPrivateKey(BigInteger n, BigInteger d) - Constructs a raw RSA private key given the private exponent, and
the public modulus n.
|
RawRSAPrivateKey(BigInteger d, BigInteger p, BigInteger q) - Constructs a raw RSA private key given the private exponent, and
the two factors used to generate the public modulus n.
|
RawRSAPrivateKey(BigInteger d, BigInteger p, BigInteger q, BigInteger u) - Constructs a raw RSA private key given the private exponent, and
the two factors used to generate the public modulus n.
|
RawRSAPrivateKey(InputStream is) - Constructs a raw RSA private key from data read from an InputStream,
encoded as described above.
|
byte[] | getEncoded() - Returns an encoding of the key as a byte array, as described
above.
|
String | getFormat() - Returns the encoding format name, for this class always "RAW".
|
RawRSAPrivateKey
public RawRSAPrivateKey(BigInteger n,
BigInteger d)
Constructs a raw RSA private key given the private exponent, and
the public modulus n. This should be used only when the
factors of n are unknown.
n
- the public modulusd
- the private exponent
RawRSAPrivateKey
public RawRSAPrivateKey(BigInteger d,
BigInteger p,
BigInteger q)
Constructs a raw RSA private key given the private exponent, and
the two factors used to generate the public modulus n.
The factors may be in any order.
d
- the private exponentp
- the first factor of the public modulusq
- the second factor of the public modulus
RawRSAPrivateKey
public RawRSAPrivateKey(BigInteger d,
BigInteger p,
BigInteger q,
BigInteger u)
Constructs a raw RSA private key given the private exponent, and
the two factors used to generate the public modulus n.
The factors must be given in the correct order, such
that u = q^-1 mod p.
d
- the private exponentp
- the first factor of the public modulusq
- the second factor of the public modulusu
- the multiplicative inverse of q modulo p
RawRSAPrivateKey
public RawRSAPrivateKey(InputStream is)
throws IOException
Constructs a raw RSA private key from data read from an InputStream,
encoded as described
above.
is
- the input stream from which data is parsed.
getEncoded()
getEncoded
public byte[] getEncoded()
Returns an encoding of the key as a byte array, as described
above.
- the encoded byte array, or null if an error occurred.
getFormat
public String getFormat()
Returns the encoding format name, for this class always "RAW".
- the encoding format name for this key, "RAW".