encodeToTlv

open override fun encodeToTlv(): Asn1Sequence(source)

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

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