org.bouncycastle.asn1.pkcs
Class PrivateKeyInfo
java.lang.Object
|
+--org.bouncycastle.asn1.ASN1Object
|
+--org.bouncycastle.asn1.pkcs.PrivateKeyInfo
- All Implemented Interfaces:
- ASN1Encodable, Encodable
- public class PrivateKeyInfo
- extends ASN1Object
RFC 5958
[IMPLICIT TAGS]
OneAsymmetricKey ::= SEQUENCE {
version Version,
privateKeyAlgorithm PrivateKeyAlgorithmIdentifier,
privateKey PrivateKey,
attributes [0] Attributes OPTIONAL,
[],
[[2: publicKey [1] PublicKey OPTIONAL ]],
[]
}
PrivateKeyInfo ::= OneAsymmetricKey
Version ::= INTEGER { v1(0), v2(1) } (v1, [], v2)
PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier
{ PUBLIC-KEY,
{ PrivateKeyAlgorithms } }
PrivateKey ::= OCTET STRING
-- Content varies based on type of key. The
-- algorithm identifier dictates the format of
-- the key.
PublicKey ::= BIT STRING
-- Content varies based on type of key. The
-- algorithm identifier dictates the format of
-- the key.
Attributes ::= SET OF Attribute { { OneAsymmetricKeyAttributes } }
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
PrivateKeyInfo
public PrivateKeyInfo(AlgorithmIdentifier privateKeyAlgorithm,
ASN1Encodable privateKey)
throws java.io.IOException
PrivateKeyInfo
public PrivateKeyInfo(AlgorithmIdentifier privateKeyAlgorithm,
ASN1Encodable privateKey,
ASN1Set attributes)
throws java.io.IOException
PrivateKeyInfo
public PrivateKeyInfo(AlgorithmIdentifier privateKeyAlgorithm,
ASN1Encodable privateKey,
ASN1Set attributes,
byte[] publicKey)
throws java.io.IOException
getInstance
public static PrivateKeyInfo getInstance(ASN1TaggedObject obj,
boolean explicit)
getInstance
public static PrivateKeyInfo getInstance(java.lang.Object obj)
getVersion
public ASN1Integer getVersion()
getAttributes
public ASN1Set getAttributes()
getPrivateKeyAlgorithm
public AlgorithmIdentifier getPrivateKeyAlgorithm()
getPrivateKey
public ASN1OctetString getPrivateKey()
getPrivateKeyLength
public int getPrivateKeyLength()
parsePrivateKey
public ASN1Encodable parsePrivateKey()
throws java.io.IOException
hasPublicKey
public boolean hasPublicKey()
- Return true if a public key is present, false otherwise.
- Returns:
- true if public included, otherwise false.
parsePublicKey
public ASN1Encodable parsePublicKey()
throws java.io.IOException
- for when the public key is an encoded object - if the bitstring
can't be decoded this routine throws an IOException.
- Returns:
- the public key as an ASN.1 primitive.
- Throws:
java.io.IOException
- - if the bit string doesn't represent a DER
encoded object.
getPublicKeyData
public ASN1BitString getPublicKeyData()
- for when the public key is raw bits.
- Returns:
- the public key as the raw bit string[]
toASN1Primitive
public ASN1Primitive toASN1Primitive()
- Description copied from class:
ASN1Object
- Method providing a primitive representation of this object suitable for encoding.
- Overrides:
toASN1Primitive
in class ASN1Object
- Following copied from class:
org.bouncycastle.asn1.ASN1Object
- Returns:
- a primitive representation of this object.