|
Bouncy Castle Cryptography Library 1.77.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.security.spec.EncodedKeySpec | +--org.bouncycastle.jcajce.spec.OpenSSHPrivateKeySpec
OpenSSHPrivateKeySpec holds and encoded OpenSSH private key. The format of the key can be either ASN.1 or OpenSSH.
Constructor Summary | |
OpenSSHPrivateKeySpec(byte[] encodedKey)
Accept an encoded key and determine the format. |
Method Summary | |
java.lang.String |
getFormat()
Return the format, either OpenSSH for the OpenSSH propriety format or ASN.1. |
Methods inherited from class java.security.spec.EncodedKeySpec |
getEncoded |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public OpenSSHPrivateKeySpec(byte[] encodedKey)
The encoded key should be the Base64 decoded blob between the "---BEGIN and ---END" markers. This constructor will endeavour to find the OpenSSH format magic value. If it can not then it will default to ASN.1. It does not attempt to validate the ASN.1
Example: OpenSSHPrivateKeySpec privSpec = new OpenSSHPrivateKeySpec(rawPriv);
KeyFactory kpf = KeyFactory.getInstance("RSA", "BC"); PrivateKey prk = kpf.generatePrivate(privSpec);
OpenSSHPrivateKeySpec rcPrivateSpec = kpf.getKeySpec(prk, OpenSSHPrivateKeySpec.class);
encodedKey
- The encoded key.Method Detail |
public java.lang.String getFormat()
getFormat
in class java.security.spec.EncodedKeySpec
|
Bouncy Castle Cryptography Library 1.77.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |