encodeToTlv

open override fun encodeToTlv(): Asn1Sequence

PKCS#8 encoding of a private key:

PrivateKeyInfo ::= SEQUENCE {
version Version,
privateKeyAlgorithm PrivateKeyAlgorithmIdentifier,
privateKey PrivateKey,
attributes [0] IMPLICIT Attributes OPTIONAL
}

Version ::= INTEGER

PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier

PrivateKey ::= OCTET STRING

Attributes ::= SET OF Attribute

Throws

Asn1StructuralException

if this is EC.WithoutPublicKey, such as decoded from minimal SEC1