org.opensaml.xml.security
Class SecurityTestHelper

java.lang.Object
  extended by org.opensaml.xml.security.SecurityTestHelper

Deprecated. Some utility methods for doing security, credential, key and crypto-related tests.

public final class SecurityTestHelper
extends Object


Constructor Summary
private SecurityTestHelper()
          Deprecated. Constructor.
 
Method Summary
static KeyInfoCredentialResolver buildBasicInlineKeyInfoResolver()
          Deprecated. Get a basic KeyInfo credential resolver which can process standard inline data - RSAKeyValue, DSAKeyValue, X509Data.
static DSAPrivateKey buildJavaDSAPrivateKey(String base64EncodedKey)
          Deprecated. Build Java DSA private key from base64 encoding.
static DSAPublicKey buildJavaDSAPublicKey(String base64EncodedKey)
          Deprecated. Build Java DSA public key from base64 encoding.
static PrivateKey buildJavaPrivateKey(String base64EncodedKey)
          Deprecated. Build Java private key from base64 encoding. The key should have no password.
static RSAPrivateKey buildJavaRSAPrivateKey(String base64EncodedKey)
          Deprecated. Build Java RSA private key from base64 encoding.
static RSAPublicKey buildJavaRSAPublicKey(String base64EncodedKey)
          Deprecated. Build Java RSA public key from base64 encoding.
static X509Certificate buildJavaX509Cert(String base64Cert)
          Deprecated. Build Java certificate from base64 encoding.
static X509CRL buildJavaX509CRL(String base64CRL)
          Deprecated. Build Java CRL from base64 encoding.
static PublicKey buildKey(KeySpec keySpec, String keyAlgorithm)
          Deprecated. Generates a public key from the given key spec.
static SecretKey generateKey(String algo, int keyLength, String provider)
          Deprecated. Generate a random symmetric key.
static Credential generateKeyAndCredential(String algorithmURI)
          Deprecated. Generate a random symmetric key and return in a BasicCredential.
static SecretKey generateKeyFromURI(String algoURI)
          Deprecated. Randomly generates a Java JCE symmetric Key object from the specified XML Encryption algorithm URI.
static KeyPair generateKeyPair(String algo, int keyLength, String provider)
          Deprecated. Generate a random asymmetric key pair.
static Credential generateKeyPairAndCredential(String algorithmURI, int keyLength, boolean includePrivate)
          Deprecated. Generate a random asymmetric key pair and return in a BasicCredential.
static KeyPair generateKeyPairFromURI(String algoURI, int keyLength)
          Deprecated. Randomly generates a Java JCE KeyPair object from the specified XML Encryption algorithm URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecurityTestHelper

private SecurityTestHelper()
Deprecated. 
Constructor.

Method Detail

buildJavaX509Cert

public static X509Certificate buildJavaX509Cert(String base64Cert)
                                         throws CertificateException
Deprecated. Build Java certificate from base64 encoding.

Parameters:
base64Cert - base64-encoded certificate
Returns:
a native Java X509 certificate
Throws:
CertificateException - thrown if there is an error constructing certificate

buildJavaX509CRL

public static X509CRL buildJavaX509CRL(String base64CRL)
                                throws CertificateException,
                                       CRLException
Deprecated. Build Java CRL from base64 encoding.

Parameters:
base64CRL - base64-encoded CRL
Returns:
a native Java X509 CRL
Throws:
CertificateException - thrown if there is an error constructing certificate
CRLException - thrown if there is an error constructing CRL

buildJavaDSAPublicKey

public static DSAPublicKey buildJavaDSAPublicKey(String base64EncodedKey)
                                          throws KeyException
Deprecated. Build Java DSA public key from base64 encoding.

Parameters:
base64EncodedKey - base64-encoded DSA public key
Returns:
a native Java DSAPublicKey
Throws:
KeyException - thrown if there is an error constructing key

buildJavaRSAPublicKey

public static RSAPublicKey buildJavaRSAPublicKey(String base64EncodedKey)
                                          throws KeyException
Deprecated. Build Java RSA public key from base64 encoding.

Parameters:
base64EncodedKey - base64-encoded RSA public key
Returns:
a native Java RSAPublicKey
Throws:
KeyException - thrown if there is an error constructing key

buildJavaRSAPrivateKey

public static RSAPrivateKey buildJavaRSAPrivateKey(String base64EncodedKey)
                                            throws KeyException
Deprecated. Build Java RSA private key from base64 encoding.

Parameters:
base64EncodedKey - base64-encoded RSA private key
Returns:
a native Java RSAPrivateKey
Throws:
KeyException - thrown if there is an error constructing key

buildJavaDSAPrivateKey

public static DSAPrivateKey buildJavaDSAPrivateKey(String base64EncodedKey)
                                            throws KeyException
Deprecated. Build Java DSA private key from base64 encoding.

Parameters:
base64EncodedKey - base64-encoded DSA private key
Returns:
a native Java DSAPrivateKey
Throws:
KeyException - thrown if there is an error constructing key

buildJavaPrivateKey

public static PrivateKey buildJavaPrivateKey(String base64EncodedKey)
                                      throws KeyException
Deprecated. Build Java private key from base64 encoding. The key should have no password.

Parameters:
base64EncodedKey - base64-encoded private key
Returns:
a native Java PrivateKey
Throws:
KeyException - thrown if there is an error constructing key

buildKey

public static PublicKey buildKey(KeySpec keySpec,
                                 String keyAlgorithm)
                          throws KeyException
Deprecated. Generates a public key from the given key spec.

Parameters:
keySpec - KeySpec specification for the key
keyAlgorithm - key generation algorithm, only DSA and RSA supported
Returns:
the generated PublicKey
Throws:
KeyException - thrown if the key algorithm is not supported by the JCE or the key spec does not contain valid information

generateKeyFromURI

public static SecretKey generateKeyFromURI(String algoURI)
                                    throws NoSuchAlgorithmException,
                                           NoSuchProviderException
Deprecated. Randomly generates a Java JCE symmetric Key object from the specified XML Encryption algorithm URI.

Parameters:
algoURI - The XML Encryption algorithm URI
Returns:
a randomly-generated symmteric key
Throws:
NoSuchProviderException - provider not found
NoSuchAlgorithmException - algorithm not found

generateKeyPairFromURI

public static KeyPair generateKeyPairFromURI(String algoURI,
                                             int keyLength)
                                      throws NoSuchAlgorithmException,
                                             NoSuchProviderException
Deprecated. Randomly generates a Java JCE KeyPair object from the specified XML Encryption algorithm URI.

Parameters:
algoURI - The XML Encryption algorithm URI
keyLength - the length of key to generate
Returns:
a randomly-generated KeyPair
Throws:
NoSuchProviderException - provider not found
NoSuchAlgorithmException - algorithm not found

generateKey

public static SecretKey generateKey(String algo,
                                    int keyLength,
                                    String provider)
                             throws NoSuchAlgorithmException,
                                    NoSuchProviderException
Deprecated. Generate a random symmetric key.

Parameters:
algo - key algorithm
keyLength - key length
provider - JCA provider
Returns:
randomly generated symmetric key
Throws:
NoSuchAlgorithmException - algorithm not found
NoSuchProviderException - provider not found

generateKeyPair

public static KeyPair generateKeyPair(String algo,
                                      int keyLength,
                                      String provider)
                               throws NoSuchAlgorithmException,
                                      NoSuchProviderException
Deprecated. Generate a random asymmetric key pair.

Parameters:
algo - key algorithm
keyLength - key length
provider - JCA provider
Returns:
randomly generated key
Throws:
NoSuchAlgorithmException - algorithm not found
NoSuchProviderException - provider not found

generateKeyAndCredential

public static Credential generateKeyAndCredential(String algorithmURI)
                                           throws NoSuchAlgorithmException,
                                                  NoSuchProviderException
Deprecated. Generate a random symmetric key and return in a BasicCredential.

Parameters:
algorithmURI - The XML Encryption algorithm URI
Returns:
a basic credential containing a randomly generated symmetric key
Throws:
NoSuchAlgorithmException - algorithm not found
NoSuchProviderException - provider not found

generateKeyPairAndCredential

public static Credential generateKeyPairAndCredential(String algorithmURI,
                                                      int keyLength,
                                                      boolean includePrivate)
                                               throws NoSuchAlgorithmException,
                                                      NoSuchProviderException
Deprecated. Generate a random asymmetric key pair and return in a BasicCredential.

Parameters:
algorithmURI - The XML Encryption algorithm URI
keyLength - key length
includePrivate - if true, the private key will be included as well
Returns:
a basic credential containing a randomly generated asymmetric key pair
Throws:
NoSuchAlgorithmException - algorithm not found
NoSuchProviderException - provider not found

buildBasicInlineKeyInfoResolver

public static KeyInfoCredentialResolver buildBasicInlineKeyInfoResolver()
Deprecated. Get a basic KeyInfo credential resolver which can process standard inline data - RSAKeyValue, DSAKeyValue, X509Data.

Returns:
a new KeyInfoCredentialResolver instance


Copyright © 1999-2012. All Rights Reserved.