* if an exception is thrown while encoding the given key.
* No such exception should ever happen.
*/
public PrivateKeyInfo(AlgorithmIdentifier aid, ASN1Type key) {
ByteArrayOutputStream bos;
DEREncoder enc;
byte[] code;
version_ = new ASN1Integer(VERSION);
add(version_);
algorithm_ = aid;
add(algorithm_);
try {
bos = new ByteArrayOutputStream();
enc = new DEREncoder(bos);
key.encode(enc);
code = bos.toByteArray();
enc.close();
} catch (IOException e) {
throw new InconsistentStateException("Caught IOException!");
} catch (ASN1Exception e) {
throw new InconsistentStateException("Caught ASN1Exception!");
}