Package com.sun.identity.saml2.key
Class KeyUtil
- java.lang.Object
-
- com.sun.identity.saml2.key.KeyUtil
-
public class KeyUtil extends Object
TheKeyUtilprovides methods to obtain the hosting entity's signing key and decryption key, and to obtain a partner entity's signature verification key and encryption related information
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclear()Clears the cache.static X509CertificategetCert(KeyDescriptorType kd)Returns certificate stored inKeyDescriptorType.static PrivateKeygetDecryptionKey(BaseConfigType baseConfig)Returns the host entity's decryption key.static Set<PrivateKey>getDecryptionKeys(BaseConfigType baseConfig)Returns the host entity's decryption keys.static Set<PrivateKey>getDecryptionKeys(String realm, String entityID, String role)Returns the hosted entity's decryption keys.static EncInfogetEncInfo(RoleDescriptorType roled, String entityID, String role)Returns the encryption information which will be used in encrypting messages intended for the partner entity.static KeyDescriptorTypegetKeyDescriptor(RoleDescriptorType roled, String usage)ReturnsKeyDescriptorTypefromRoleDescriptorType.static List<KeyDescriptorType>getKeyDescriptors(RoleDescriptorType roleDescriptor, String usage)Returns theKeyDescriptorTypes fromRoleDescriptorTypethat matches the requested usage.static KeyProvidergetKeyProviderInstance()Returns the instance ofKeyProvider.static Set<X509Certificate>getPDPVerificationCerts(XACMLPDPDescriptorElement pdpDescriptor, String entityID)Returns the partner entity's signature verification certificates.static EncInfogetPEPEncInfo(XACMLAuthzDecisionQueryDescriptorElement pepDesc, String pepEntityID)Returns the encryption information which will be used in encrypting messages intended for the partner entity.static Set<X509Certificate>getPEPVerificationCerts(XACMLAuthzDecisionQueryDescriptorElement pepDescriptor, String entityID)Returns the partner entity's signature verification certificates.static StringgetSigningCertAlias(BaseConfigType baseConfig)Returns the host entity's signing certificate alias.static Set<X509Certificate>getVerificationCerts(RoleDescriptorType roleDescriptor, String entityID, String role)Returns the partner entity's signature verification certificate.
-
-
-
Field Detail
-
encHash
protected static Hashtable encHash
-
sigHash
protected static Map<String,Set<X509Certificate>> sigHash
-
-
Method Detail
-
getKeyProviderInstance
public static KeyProvider getKeyProviderInstance()
Returns the instance ofKeyProvider.- Returns:
KeyProvider
-
getSigningCertAlias
public static String getSigningCertAlias(BaseConfigType baseConfig)
Returns the host entity's signing certificate alias.- Parameters:
baseConfig-BaseConfigTypefor the host entity- Returns:
Stringfor host entity's signing certificate alias
-
getDecryptionKeys
public static Set<PrivateKey> getDecryptionKeys(String realm, String entityID, String role)
Returns the hosted entity's decryption keys.- Parameters:
realm- The realm the hosted entity belongs to.entityID- The entity ID.role- The role of the hosted entity.- Returns:
- The Set of
PrivateKeys for decrypting a message received by the hosted entity.
-
getDecryptionKeys
public static Set<PrivateKey> getDecryptionKeys(BaseConfigType baseConfig)
Returns the host entity's decryption keys.- Parameters:
baseConfig-BaseConfigTypefor the host entity.- Returns:
- The Set of
PrivateKeys for decrypting a message received by the hosted entity.
-
getDecryptionKey
public static PrivateKey getDecryptionKey(BaseConfigType baseConfig)
Returns the host entity's decryption key.- Parameters:
baseConfig-BaseConfigTypefor the host entity- Returns:
PrivateKeyfor decrypting a message received by the host entity
-
getVerificationCerts
public static Set<X509Certificate> getVerificationCerts(RoleDescriptorType roleDescriptor, String entityID, String role)
Returns the partner entity's signature verification certificate.- Parameters:
roleDescriptor-RoleDescriptorfor the partner entity.entityID- Partner entity's ID.role- Entity's role.- Returns:
- The set of signing
X509Certificatefor verifying the partner entity's signature.
-
getEncInfo
public static EncInfo getEncInfo(RoleDescriptorType roled, String entityID, String role)
Returns the encryption information which will be used in encrypting messages intended for the partner entity.- Parameters:
roled-RoleDescriptorfor the partner entityentityID- partner entity's IDrole- entity's role- Returns:
EncInfowhich includes partner entity's public key for wrapping the secret key, data encryption algorithm, and data encryption strength
-
getKeyDescriptors
public static List<KeyDescriptorType> getKeyDescriptors(RoleDescriptorType roleDescriptor, String usage)
Returns theKeyDescriptorTypes fromRoleDescriptorTypethat matches the requested usage. KeyDescriptors without usage defined are also included in this list, as by definition they should be suitable for any purposes.- Parameters:
roleDescriptor-RoleDescriptorTypewhich containsKeyDescriptorTypes.usage- Type of theKeyDescriptorTypes to be retrieved. Its value is "encryption" or "signing".- Returns:
KeyDescriptorTypes inRoleDescriptorTypethat matched the usage type.
-
getKeyDescriptor
public static KeyDescriptorType getKeyDescriptor(RoleDescriptorType roled, String usage)
ReturnsKeyDescriptorTypefromRoleDescriptorType.- Parameters:
roled-RoleDescriptorTypewhich containsKeyDescriptors.usage- type of theKeyDescriptorTypeto be retrieved. Its value is "encryption" or "signing".- Returns:
- KeyDescriptorType in
RoleDescriptorTypethat matched the usage type.
-
getCert
public static X509Certificate getCert(KeyDescriptorType kd)
Returns certificate stored inKeyDescriptorType.- Parameters:
kd-KeyDescriptorTypewhich contains certificate info- Returns:
- X509Certificate contained in
KeyDescriptorType; ornullif no certificate is included.
-
getPEPVerificationCerts
public static Set<X509Certificate> getPEPVerificationCerts(XACMLAuthzDecisionQueryDescriptorElement pepDescriptor, String entityID)
Returns the partner entity's signature verification certificates.- Parameters:
pepDescriptor-XACMLAuthzDecisionQueryDescriptorElementfor the partner entity.entityID- Policy Enforcement Point (PEP) entity identifier.- Returns:
- The Set of signing
X509Certificates for verifying the partner entity's signature.
-
getPEPEncInfo
public static EncInfo getPEPEncInfo(XACMLAuthzDecisionQueryDescriptorElement pepDesc, String pepEntityID)
Returns the encryption information which will be used in encrypting messages intended for the partner entity.- Parameters:
pepDesc-XACMLAuthzDecisionQueryDescriptorElementfor the partner entitypepEntityID- partner entity's ID- Returns:
EncInfowhich includes partner entity's public key for wrapping the secret key, data encryption algorithm, and data encryption strength
-
getPDPVerificationCerts
public static Set<X509Certificate> getPDPVerificationCerts(XACMLPDPDescriptorElement pdpDescriptor, String entityID)
Returns the partner entity's signature verification certificates.- Parameters:
pdpDescriptor-XACMLPDPDescriptorElementof partner entity.entityID- partner entity's ID.- Returns:
- The Set of signing
X509Certificates for verifying the partner entity's signature.
-
clear
public static void clear()
Clears the cache. This method is called when metadata is updated.
-
-