Class RSAPrivateKeyPKCS8
- java.lang.Object
-
- com.github.toolarium.security.rsa.RSAPrivateKeyPKCS8
-
- All Implemented Interfaces:
java.io.Serializable,java.security.interfaces.RSAKey,java.security.interfaces.RSAPrivateKey,java.security.Key,java.security.PrivateKey,javax.security.auth.Destroyable
public class RSAPrivateKeyPKCS8 extends java.lang.Object implements java.security.interfaces.RSAPrivateKeyThis class implements the encoding of a RSA private key- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RSAPrivateKeyPKCS8(byte[] encoded)Default constructor for RSAPrivateKeyPKCS8RSAPrivateKeyPKCS8(java.security.spec.RSAPrivateCrtKeySpec keyspec)Copy constructor for RSAPrivateKeyPKCS8
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckEncoding()Check the encodingjava.lang.StringgetAlgorithm()byte[]getEncoded()java.lang.StringgetFormat()java.security.spec.RSAPrivateKeySpecgetKeySpec()Gets the key specificationjava.math.BigIntegergetModulus()java.math.BigIntegergetPrivateExponent()
-
-
-
Constructor Detail
-
RSAPrivateKeyPKCS8
public RSAPrivateKeyPKCS8(byte[] encoded)
Default constructor for RSAPrivateKeyPKCS8- Parameters:
encoded- the private key as byte array
-
RSAPrivateKeyPKCS8
public RSAPrivateKeyPKCS8(java.security.spec.RSAPrivateCrtKeySpec keyspec)
Copy constructor for RSAPrivateKeyPKCS8- Parameters:
keyspec- the class
-
-
Method Detail
-
getAlgorithm
public java.lang.String getAlgorithm()
- Specified by:
getAlgorithmin interfacejava.security.Key- See Also:
Key.getAlgorithm()
-
getFormat
public java.lang.String getFormat()
- Specified by:
getFormatin interfacejava.security.Key- See Also:
Key.getFormat()
-
checkEncoding
public void checkEncoding() throws java.security.spec.InvalidKeySpecExceptionCheck the encoding- Throws:
java.security.spec.InvalidKeySpecException- in case of error
-
getEncoded
public byte[] getEncoded()
- Specified by:
getEncodedin interfacejava.security.Key- See Also:
Key.getEncoded()
-
getKeySpec
public java.security.spec.RSAPrivateKeySpec getKeySpec()
Gets the key specification- Returns:
- the key spec
-
getPrivateExponent
public java.math.BigInteger getPrivateExponent()
- Specified by:
getPrivateExponentin interfacejava.security.interfaces.RSAPrivateKey- See Also:
RSAPrivateKey.getPrivateExponent()
-
getModulus
public java.math.BigInteger getModulus()
- Specified by:
getModulusin interfacejava.security.interfaces.RSAKey- See Also:
RSAKey.getModulus()
-
-