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 java.lang.Object


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

Method Detail

buildJavaX509Cert

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

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

buildJavaX509CRL

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

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

buildJavaDSAPublicKey

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

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

buildJavaRSAPublicKey

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

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

buildJavaRSAPrivateKey

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

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

buildJavaDSAPrivateKey

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

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

buildJavaPrivateKey

public static java.security.PrivateKey buildJavaPrivateKey(java.lang.String base64EncodedKey)
                                                    throws java.security.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:
java.security.KeyException - thrown if there is an error constructing key

buildKey

public static java.security.PublicKey buildKey(java.security.spec.KeySpec keySpec,
                                               java.lang.String keyAlgorithm)
                                        throws java.security.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:
java.security.KeyException - thrown if the key algorithm is not supported by the JCE or the key spec does not contain valid information

generateKeyFromURI

public static javax.crypto.SecretKey generateKeyFromURI(java.lang.String algoURI)
                                                 throws java.security.NoSuchAlgorithmException,
                                                        java.security.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:
java.security.NoSuchProviderException - provider not found
java.security.NoSuchAlgorithmException - algorithm not found

generateKeyPairFromURI

public static java.security.KeyPair generateKeyPairFromURI(java.lang.String algoURI,
                                                           int keyLength)
                                                    throws java.security.NoSuchAlgorithmException,
                                                           java.security.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:
java.security.NoSuchProviderException - provider not found
java.security.NoSuchAlgorithmException - algorithm not found

generateKey

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

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

generateKeyPair

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

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

generateKeyAndCredential

public static Credential generateKeyAndCredential(java.lang.String algorithmURI)
                                           throws java.security.NoSuchAlgorithmException,
                                                  java.security.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:
java.security.NoSuchAlgorithmException - algorithm not found
java.security.NoSuchProviderException - provider not found

generateKeyPairAndCredential

public static Credential generateKeyPairAndCredential(java.lang.String algorithmURI,
                                                      int keyLength,
                                                      boolean includePrivate)
                                               throws java.security.NoSuchAlgorithmException,
                                                      java.security.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:
java.security.NoSuchAlgorithmException - algorithm not found
java.security.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 © 2006-2012 Internet2. All Rights Reserved.