Bouncy Castle Cryptography Library 1.66

org.bouncycastle.jce.spec
Class OpenSSHPrivateKeySpec

java.lang.Object
  extended byjava.security.spec.EncodedKeySpec
      extended byorg.bouncycastle.jcajce.spec.OpenSSHPrivateKeySpec
          extended byorg.bouncycastle.jce.spec.OpenSSHPrivateKeySpec
All Implemented Interfaces:
java.security.spec.KeySpec

Deprecated. use org.bouncycastle.jcajce.spec.OpenSSHPrivateKeySpec

public class OpenSSHPrivateKeySpec
extends 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)
          Deprecated. Accept an encoded key and determine the format.
 
Methods inherited from class org.bouncycastle.jcajce.spec.OpenSSHPrivateKeySpec
getFormat
 
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

OpenSSHPrivateKeySpec

public OpenSSHPrivateKeySpec(byte[] encodedKey)
Deprecated. 
Accept an encoded key and determine the format.

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);

Parameters:
encodedKey - The encoded key.

Bouncy Castle Cryptography Library 1.66