org.springframework.security.oauth.common.signature
Class RSAKeySecret

java.lang.Object
  extended by org.springframework.security.oauth.common.signature.RSAKeySecret
All Implemented Interfaces:
Serializable, SignatureSecret

public class RSAKeySecret
extends Object
implements SignatureSecret

Signature secret for RSA.

Author:
Ryan Heaton
See Also:
Serialized Form

Constructor Summary
RSAKeySecret(byte[] publicKey)
          Create an RSA public key secret with the given public key value.
RSAKeySecret(byte[] privateKey, byte[] publicKey)
          Create an RSA public key secret with the given private and public key value.
RSAKeySecret(PrivateKey privateKey, PublicKey publicKey)
           
RSAKeySecret(PublicKey publicKey)
          Construct an RSA public key secret with the given public key.
RSAKeySecret(String publicKey)
          Create an RSA public key secret with the given public key value.
RSAKeySecret(String privateKey, String publicKey)
          Create an RSA public key secret with the given private and public key.
RSAKeySecret(X509Certificate certificate)
          Create an RSA public key secret with the given X509 certificate.
 
Method Summary
static PrivateKey createPrivateKey(byte[] privateKey)
          Creates a private key from the PKCS#8-encoded value of the given bytes.
static PublicKey createPublicKey(byte[] publicKey)
          Creates a public key from the X509-encoded value of the given bytes.
 PrivateKey getPrivateKey()
          The private key.
 PublicKey getPublicKey()
          The public key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RSAKeySecret

public RSAKeySecret(PrivateKey privateKey,
                    PublicKey publicKey)

RSAKeySecret

public RSAKeySecret(byte[] privateKey,
                    byte[] publicKey)
Create an RSA public key secret with the given private and public key value. The value of the private key is assumed to be the PKCS#8-encoded bytes of the private key. The value of the public key is assumed to be the X509-encoded bytes of the public key.

Parameters:
privateKey - The value of the private key.
publicKey - The value of the public key.

RSAKeySecret

public RSAKeySecret(String privateKey,
                    String publicKey)
Create an RSA public key secret with the given private and public key. The values are assumed to be the Base64-encoded values of the bytes of the keys, X509-encoded for the public key and PKCS#8-encoded for the private key.

Parameters:
privateKey - The value of the private key.
publicKey - The value of the public key.

RSAKeySecret

public RSAKeySecret(PublicKey publicKey)
Construct an RSA public key secret with the given public key. The private key will be null.

Parameters:
publicKey - The public key.

RSAKeySecret

public RSAKeySecret(byte[] publicKey)
Create an RSA public key secret with the given public key value. The value is assumed to be the X509-encoded bytes of the public key. The private key will be null.

Parameters:
publicKey - The value of the public key.

RSAKeySecret

public RSAKeySecret(String publicKey)
Create an RSA public key secret with the given public key value. The value is assumed to be the Base64-encoded value of the X509-encoded bytes of the public key. The private key will be null.

Parameters:
publicKey - The value of the public key.

RSAKeySecret

public RSAKeySecret(X509Certificate certificate)
Create an RSA public key secret with the given X509 certificate. The private key will be null.

Parameters:
certificate - The certificate.
Method Detail

createPublicKey

public static PublicKey createPublicKey(byte[] publicKey)
Creates a public key from the X509-encoded value of the given bytes.

Parameters:
publicKey - The X509-encoded public key bytes.
Returns:
The public key.

createPrivateKey

public static PrivateKey createPrivateKey(byte[] privateKey)
Creates a private key from the PKCS#8-encoded value of the given bytes.

Parameters:
privateKey - The PKCS#8-encoded private key bytes.
Returns:
The private key.

getPrivateKey

public PrivateKey getPrivateKey()
The private key.

Returns:
The private key.

getPublicKey

public PublicKey getPublicKey()
The public key.

Returns:
The public key.


Copyright © 2012. All Rights Reserved.