本文整理汇总了Java中org.apache.xml.security.algorithms.JCEMapper类的典型用法代码示例。如果您正苦于以下问题:Java JCEMapper类的具体用法?Java JCEMapper怎么用?Java JCEMapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JCEMapper类属于org.apache.xml.security.algorithms包,在下文中一共展示了JCEMapper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getKeyLengthFromURI
import org.apache.xml.security.algorithms.JCEMapper; //导入依赖的package包/类
/**
* Get the length of the key indicated by the algorithm URI, if applicable and available.
*
* @param algorithmURI the algorithm URI to evaluate
* @return the length of the key indicated by the algorithm URI, or null if the length is either unavailable or
* indeterminable from the URI
*/
public static Integer getKeyLengthFromURI(String algorithmURI) {
Logger log = getLogger();
String algoClass = DatatypeHelper.safeTrimOrNullString(JCEMapper.getAlgorithmClassFromURI(algorithmURI));
if (ApacheXMLSecurityConstants.ALGO_CLASS_BLOCK_ENCRYPTION.equals(algoClass)
|| ApacheXMLSecurityConstants.ALGO_CLASS_SYMMETRIC_KEY_WRAP.equals(algoClass)) {
try {
int keyLength = JCEMapper.getKeyLengthFromURI(algorithmURI);
return new Integer(keyLength);
} catch (NumberFormatException e) {
log.warn("XML Security config contained invalid key length value for algorithm URI: " + algorithmURI);
}
}
log.info("Mapping from algorithm URI {} to key length not available", algorithmURI);
return null;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:SecurityHelper.java
示例2: constructCipher
import org.apache.xml.security.algorithms.JCEMapper; //导入依赖的package包/类
/**
* Construct a Cipher object
*/
private Cipher constructCipher(String algorithm, String digestAlgorithm) throws XMLEncryptionException {
String jceAlgorithm = JCEMapper.translateURItoJCEID(algorithm);
if (log.isDebugEnabled()) {
log.debug("JCE Algorithm = " + jceAlgorithm);
}
Cipher c;
try {
if (requestedJCEProvider == null) {
c = Cipher.getInstance(jceAlgorithm);
} else {
c = Cipher.getInstance(jceAlgorithm, requestedJCEProvider);
}
} catch (NoSuchAlgorithmException nsae) {
// Check to see if an RSA OAEP MGF-1 with SHA-1 algorithm was requested
// Some JDKs don't support RSA/ECB/OAEPPadding
c = constructCipher(algorithm, digestAlgorithm, nsae);
} catch (NoSuchProviderException nspre) {
throw new XMLEncryptionException(nspre);
} catch (NoSuchPaddingException nspae) {
throw new XMLEncryptionException(nspae);
}
return c;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:29,代码来源:XMLCipher.java
示例3: getCipher
import org.apache.xml.security.algorithms.JCEMapper; //导入依赖的package包/类
private Cipher getCipher(int cipherMode, String algorithmUri) throws NoSuchAlgorithmException, NoSuchPaddingException, NoSuchProviderException, InvalidKeyException, InvalidAlgorithmParameterException {
String jceAlgorithm = JCEMapper.translateURItoJCEID(algorithmUri);//JCEMapper.getJCEKeyAlgorithmFromURI(algorithmUri);
Cipher cipher;
if (requestedJceProviderName == null) {
cipher = Cipher.getInstance(jceAlgorithm);
} else {
cipher = Cipher.getInstance(jceAlgorithm, requestedJceProviderName);
}
if (LOGGER.isTraceEnabled()) {
String desc;
if (cipherMode == Cipher.ENCRYPT_MODE) {
desc = "Encrypting";
} else if (cipherMode == Cipher.DECRYPT_MODE) {
desc = "Decrypting";
} else {
desc = "Ciphering (mode " + cipherMode + ")";
}
LOGGER.trace("{} data by JCE algorithm {} (URI {}), cipher {}, provider {}", new Object[]{
desc, jceAlgorithm, algorithmUri, cipher.getAlgorithm(), cipher.getProvider().getName()});
}
return cipher;
}
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:23,代码来源:ProtectorImpl.java
示例4: getEngine
import org.apache.xml.security.algorithms.JCEMapper; //导入依赖的package包/类
@Override
public MessageDigest getEngine(String digestAlgorithmURI) throws UnsupportedAlgorithmException
{
String digestAlgorithmName = JCEMapper.translateURItoJCEID(digestAlgorithmURI);
if (null == digestAlgorithmName) {
throw new UnsupportedAlgorithmException("Digest algorithm not supported by the provider", digestAlgorithmURI);
}
try {
return this.messageDigestProvider == null ?
MessageDigest.getInstance(digestAlgorithmName) :
MessageDigest.getInstance(digestAlgorithmName, this.messageDigestProvider);
} catch (NoSuchAlgorithmException nsae) {
throw new UnsupportedAlgorithmException(nsae.getMessage(), digestAlgorithmURI, nsae);
} catch (NoSuchProviderException nspe) {
// We checked that the provider existed on construction, but throw anyway
throw new UnsupportedAlgorithmException("Provider not available", digestAlgorithmURI, nspe);
}
}
开发者ID:luisgoncalves,项目名称:xades4j,代码行数:20,代码来源:DefaultMessageDigestProvider.java
示例5: getKeyGenerator
import org.apache.xml.security.algorithms.JCEMapper; //导入依赖的package包/类
private KeyGenerator getKeyGenerator() throws WSSecurityException {
try {
//
// Assume AES as default, so initialize it
//
String keyAlgorithm = JCEMapper.getJCEKeyAlgorithmFromURI(symEncAlgo);
KeyGenerator keyGen = KeyGenerator.getInstance(keyAlgorithm);
if (symEncAlgo.equalsIgnoreCase(WSConstants.AES_128)) {
keyGen.init(128);
} else if (symEncAlgo.equalsIgnoreCase(WSConstants.AES_192)) {
keyGen.init(192);
} else if (symEncAlgo.equalsIgnoreCase(WSConstants.AES_256)) {
keyGen.init(256);
}
return keyGen;
} catch (NoSuchAlgorithmException e) {
throw new WSSecurityException(
WSSecurityException.UNSUPPORTED_ALGORITHM, null, null, e
);
}
}
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:22,代码来源:WSSecEncrypt.java
示例6: getKeyAlgorithmFromURI
import org.apache.xml.security.algorithms.JCEMapper; //导入依赖的package包/类
/**
* Get the Java security JCA/JCE key algorithm specifier associated with an algorithm URI.
*
* @param algorithmURI the algorithm URI to evaluate
* @return the Java key algorithm specifier, or null if the mapping is unavailable or indeterminable from the URI
*/
public static String getKeyAlgorithmFromURI(String algorithmURI) {
// The default Apache config file currently only includes the key algorithm for
// the block ciphers and key wrap URI's. Note: could use a custom config file which contains others.
String apacheValue = DatatypeHelper.safeTrimOrNullString(JCEMapper.getJCEKeyAlgorithmFromURI(algorithmURI));
if (apacheValue != null) {
return apacheValue;
}
// HMAC uses any symmetric key, so there is no implied specific key algorithm
if (isHMAC(algorithmURI)) {
return null;
}
// As a last ditch fallback, check some known common and supported ones.
if (rsaAlgorithmURIs.contains(algorithmURI)) {
return "RSA";
}
if (dsaAlgorithmURIs.contains(algorithmURI)) {
return "DSA";
}
if (ecdsaAlgorithmURIs.contains(algorithmURI)) {
return "EC";
}
return null;
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:33,代码来源:SecurityHelper.java
示例7: constructCipher
import org.apache.xml.security.algorithms.JCEMapper; //导入依赖的package包/类
/**
* Construct a Cipher object
*/
private Cipher constructCipher(String algorithm, String digestAlgorithm) throws XMLEncryptionException {
String jceAlgorithm = JCEMapper.translateURItoJCEID(algorithm);
if (log.isDebugEnabled()) {
log.debug("JCE Algorithm = " + jceAlgorithm);
}
Cipher c;
try {
if (requestedJCEProvider == null) {
c = Cipher.getInstance(jceAlgorithm);
} else {
c = Cipher.getInstance(jceAlgorithm, requestedJCEProvider);
}
} catch (NoSuchAlgorithmException nsae) {
// Check to see if an RSA OAEP MGF-1 with SHA-1 algorithm was requested
// Some JDKs don't support RSA/ECB/OAEPPadding
if (XMLCipher.RSA_OAEP.equals(algorithm)
&& (digestAlgorithm == null
|| MessageDigestAlgorithm.ALGO_ID_DIGEST_SHA1.equals(digestAlgorithm))) {
try {
if (requestedJCEProvider == null) {
c = Cipher.getInstance("RSA/ECB/OAEPWithSHA1AndMGF1Padding");
} else {
c = Cipher.getInstance("RSA/ECB/OAEPWithSHA1AndMGF1Padding", requestedJCEProvider);
}
} catch (Exception ex) {
throw new XMLEncryptionException("empty", ex);
}
} else {
throw new XMLEncryptionException("empty", nsae);
}
} catch (NoSuchProviderException nspre) {
throw new XMLEncryptionException("empty", nspre);
} catch (NoSuchPaddingException nspae) {
throw new XMLEncryptionException("empty", nspae);
}
return c;
}
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:43,代码来源:XMLCipher.java
示例8: prepareSecretKey
import org.apache.xml.security.algorithms.JCEMapper; //导入依赖的package包/类
/**
* Convert the raw key bytes into a SecretKey object of type symEncAlgo.
*/
public static SecretKey prepareSecretKey(String symEncAlgo, byte[] rawKey) {
// Do an additional check on the keysize required by the encryption algorithm
int size = 0;
try {
size = JCEMapper.getKeyLengthFromURI(symEncAlgo) / 8;
} catch (Exception e) {
// ignore - some unknown (to JCEMapper) encryption algorithm
size = 0;
}
String keyAlgorithm = JCEMapper.getJCEKeyAlgorithmFromURI(symEncAlgo);
SecretKeySpec keySpec;
if (size > 0 && !symEncAlgo.endsWith("gcm") && !symEncAlgo.contains("hmac-")) {
keySpec =
new SecretKeySpec(
rawKey, 0, rawKey.length > size ? size : rawKey.length, keyAlgorithm
);
} else if (rawKey.length > MAX_SYMMETRIC_KEY_SIZE) {
// Prevent a possible attack where a huge secret key is specified
keySpec =
new SecretKeySpec(
rawKey, 0, MAX_SYMMETRIC_KEY_SIZE, keyAlgorithm
);
} else {
keySpec = new SecretKeySpec(rawKey, keyAlgorithm);
}
return keySpec;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:31,代码来源:XMLSecurityUtils.java
示例9: IntegrityHmac
import org.apache.xml.security.algorithms.JCEMapper; //导入依赖的package包/类
/**
* Method IntegrityHmac
*
* @throws XMLSignatureException
*/
public IntegrityHmac() throws XMLSignatureException {
String algorithmID = JCEMapper.translateURItoJCEID(this.engineGetURI());
if (log.isDebugEnabled()) {
log.debug("Created IntegrityHmacSHA1 using " + algorithmID);
}
try {
this.macAlgorithm = Mac.getInstance(algorithmID);
} catch (java.security.NoSuchAlgorithmException ex) {
Object[] exArgs = { algorithmID, ex.getLocalizedMessage() };
throw new XMLSignatureException("algorithms.NoSuchAlgorithm", exArgs);
}
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:20,代码来源:IntegrityHmac.java
示例10: EncryptContentTest
import org.apache.xml.security.algorithms.JCEMapper; //导入依赖的package包/类
public EncryptContentTest() throws Exception {
org.apache.xml.security.Init.init();
db = XMLUtils.createDocumentBuilder(false);
byte[] bits192 = "abcdefghijklmnopqrstuvwx".getBytes();
DESedeKeySpec keySpec = new DESedeKeySpec(bits192);
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DESede");
secretKey = keyFactory.generateSecret(keySpec);
TransformerFactory tf = TransformerFactory.newInstance();
tf.newTransformer();
// Determine if we have ISO 10126 Padding - needed for Bulk AES or
// 3DES encryption
haveISOPadding = false;
String algorithmId =
JCEMapper.translateURItoJCEID(
org.apache.xml.security.utils.EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES128
);
if (algorithmId != null) {
try {
if (Cipher.getInstance(algorithmId) != null) {
haveISOPadding = true;
}
} catch (NoSuchAlgorithmException nsae) {
//
} catch (NoSuchPaddingException nspe) {
//
}
}
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:34,代码来源:EncryptContentTest.java
示例11: init
import org.apache.xml.security.algorithms.JCEMapper; //导入依赖的package包/类
public void init() {
X509KeyInfoGeneratorFactory keyInfoGeneratorFactory = new X509KeyInfoGeneratorFactory();
keyInfoGeneratorFactory.setEmitEntityCertificate(true);
keyInfoGenerator = keyInfoGeneratorFactory.newInstance();
// Try to load a signature algorithm
if (loader.getSignatureAlgorithm() != null) {
SignatureAlgorithm loadedSignatureAlgorithm =
SignatureAlgorithm.valueOf(loader.getSignatureAlgorithm());
if (loadedSignatureAlgorithm != null) {
sigAlgo = loadedSignatureAlgorithm.getAlgorithm();
jceSigAlgo = JCEMapper.translateURItoJCEID(sigAlgo);
}
if (jceSigAlgo == null) {
LOG.warn("Signature algorithm {} is not valid. Using default algorithm instead.",
loader.getSignatureAlgorithm());
sigAlgo = null;
}
}
if (sigAlgo == null) {
sigAlgo = SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1;
String pubKeyAlgo = loader.getCredential().getPublicKey().getAlgorithm();
if (pubKeyAlgo.equalsIgnoreCase("DSA")) {
sigAlgo = SignatureConstants.ALGO_ID_SIGNATURE_DSA_SHA1;
} else if (pubKeyAlgo.equalsIgnoreCase("EC")) {
sigAlgo = SignatureConstants.ALGO_ID_SIGNATURE_ECDSA_SHA1;
}
jceSigAlgo = JCEMapper.translateURItoJCEID(sigAlgo);
}
callbackHandler = new SAMLSPCallbackHandler(loader.getKeyPass());
}
开发者ID:apache,项目名称:syncope,代码行数:34,代码来源:SAML2ReaderWriter.java
示例12: dynamicInit
import org.apache.xml.security.algorithms.JCEMapper; //导入依赖的package包/类
/**
* Dynamically initialise the library by registering the default algorithms/implementations
*/
private static void dynamicInit() {
//
// Load the Resource Bundle - the default is the English resource bundle.
// To load another resource bundle, call I18n.init(...) before calling this
// method.
//
I18n.init("en", "US");
if (log.isDebugEnabled()) {
log.debug("Registering default algorithms");
}
try {
AccessController.doPrivileged(new PrivilegedExceptionAction<Void>(){
@Override public Void run() throws XMLSecurityException {
//
// Bind the default prefixes
//
ElementProxy.registerDefaultPrefixes();
//
// Set the default Transforms
//
Transform.registerDefaultAlgorithms();
//
// Set the default signature algorithms
//
SignatureAlgorithm.registerDefaultAlgorithms();
//
// Set the default JCE algorithms
//
JCEMapper.registerDefaultAlgorithms();
//
// Set the default c14n algorithms
//
Canonicalizer.registerDefaultAlgorithms();
//
// Register the default resolvers
//
ResourceResolver.registerDefaultResolvers();
//
// Register the default key resolvers
//
KeyResolver.registerDefaultResolvers();
return null;
}
});
} catch (PrivilegedActionException ex) {
XMLSecurityException xse = (XMLSecurityException)ex.getException();
log.error(xse.getMessage(), xse);
}
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:61,代码来源:Init.java
示例13: XMLCipherTest
import org.apache.xml.security.algorithms.JCEMapper; //导入依赖的package包/类
public XMLCipherTest() throws Exception {
basedir = System.getProperty("basedir",".");
documentName = System.getProperty("org.apache.xml.enc.test.doc",
basedir + "/pom.xml");
elementName = System.getProperty("org.apache.xml.enc.test.elem", "project");
elementIndex = System.getProperty("org.apache.xml.enc.test.idx", "0");
tstBase64EncodedString =
"YmNkZWZnaGlqa2xtbm9wcRrPXjQ1hvhDFT+EdesMAPE4F6vlT+y0HPXe0+nAGLQ8";
// Determine if we have ISO 10126 Padding - needed for Bulk AES or
// 3DES encryption
haveISOPadding = false;
String algorithmId =
JCEMapper.translateURItoJCEID(EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES128);
if (algorithmId != null) {
try {
if (Cipher.getInstance(algorithmId) != null) {
haveISOPadding = true;
}
} catch (NoSuchAlgorithmException nsae) {
//
} catch (NoSuchPaddingException nspe) {
//
}
}
haveKeyWraps =
JCEMapper.translateURItoJCEID(EncryptionConstants.ALGO_ID_KEYWRAP_AES128) != null;
//
// If the BouncyCastle provider is not installed, then try to load it
// via reflection.
//
if (Security.getProvider("BC") == null) {
Constructor<?> cons = null;
try {
Class<?> c = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
cons = c.getConstructor(new Class[] {});
} catch (Exception e) {
//ignore
}
if (cons != null) {
Provider provider = (Provider)cons.newInstance();
Security.insertProviderAt(provider, 2);
bcInstalled = true;
}
}
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:53,代码来源:XMLCipherTest.java
示例14: BaltimoreEncTest
import org.apache.xml.security.algorithms.JCEMapper; //导入依赖的package包/类
/**
* Constructor BaltimoreEncTest
*/
public BaltimoreEncTest() throws Exception {
// Create the comparison strings
String filename =
"src/test/resources/ie/baltimore/merlin-examples/merlin-xmlenc-five/plaintext.xml";
String basedir = System.getProperty("basedir");
if (basedir != null && !"".equals(basedir)) {
filename = basedir + "/" + filename;
}
File f = new File(filename);
DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
Document doc = db.parse(new java.io.FileInputStream(f));
cardNumber = retrieveCCNumber(doc);
// Test decrypt
testDecryptString = "top secret message\n";
// Count the nodes in the document as a secondary test
nodeCount = countNodes(doc);
// Create the keys
jebBytes = "abcdefghijklmnopqrstuvwx".getBytes("ASCII");
jobBytes = "abcdefghijklmnop".getBytes("ASCII");
jedBytes = "abcdefghijklmnopqrstuvwxyz012345".getBytes("ASCII");
// Certificate information
rsaCertSerialNumber = "1014918766910";
// rsaKey
filename = "src/test/resources/ie/baltimore/merlin-examples/merlin-xmlenc-five/rsa.p8";
if (basedir != null && !"".equals(basedir)) {
filename = basedir + "/" + filename;
}
byte[] pkcs8Bytes = JavaUtils.getBytesFromFile(filename);
PKCS8EncodedKeySpec pkcs8Spec = new PKCS8EncodedKeySpec(pkcs8Bytes);
// Create a key factory
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
rsaKey = keyFactory.generatePrivate(pkcs8Spec);
// Initialise the library
org.apache.xml.security.Init.init();
// Register our key resolver
KeyResolver.register("org.apache.xml.security.test.dom.encryption.BobKeyResolver", false);
// Check what algorithms are available
haveISOPadding = false;
String algorithmId =
JCEMapper.translateURItoJCEID(EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES128);
if (algorithmId != null) {
try {
if (Cipher.getInstance(algorithmId) != null) {
haveISOPadding = true;
}
} catch (NoSuchAlgorithmException nsae) {
//
} catch (NoSuchPaddingException nspe) {
//
}
}
haveKeyWraps =
JCEMapper.translateURItoJCEID(EncryptionConstants.ALGO_ID_KEYWRAP_AES128) != null;
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:73,代码来源:BaltimoreEncTest.java
示例15: XMLEncryption11Test
import org.apache.xml.security.algorithms.JCEMapper; //导入依赖的package包/类
/**
* Constructor XMLEncryption11Test
*/
public XMLEncryption11Test() throws Exception {
//
// If the BouncyCastle provider is not installed, then try to load it
// via reflection. If it is not available, then skip this test as it is
// required for GCM algorithm support
//
if (Security.getProvider("BC") == null) {
Constructor<?> cons = null;
try {
Class<?> c = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
cons = c.getConstructor(new Class[] {});
} catch (Exception e) {
//ignore
}
if (cons != null) {
Provider provider = (Provider)cons.newInstance();
Security.insertProviderAt(provider, 2);
}
}
// Create the comparison strings
String filename =
"src/test/resources/org/w3c/www/interop/xmlenc-core-11/plaintext.xml";
String basedir = System.getProperty("basedir");
if (basedir != null && !"".equals(basedir)) {
filename = basedir + "/" + filename;
}
File f = new File(filename);
DocumentBuilder db = XMLUtils.createDocumentBuilder(false);
Document doc = db.parse(new java.io.FileInputStream(f));
cardNumber = retrieveCCNumber(doc);
// Count the nodes in the document as a secondary test
nodeCount = countNodes(doc);
// Initialise the library
org.apache.xml.security.Init.init();
// Check what algorithms are available
haveISOPadding = false;
String algorithmId =
JCEMapper.translateURItoJCEID(EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES128);
if (algorithmId != null) {
try {
if (Cipher.getInstance(algorithmId) != null) {
haveISOPadding = true;
}
} catch (NoSuchAlgorithmException nsae) {
//
} catch (NoSuchPaddingException nspe) {
//
}
}
}
开发者ID:Legostaev,项目名称:xmlsec-gost,代码行数:62,代码来源:XMLEncryption11Test.java
示例16: prepareSecretKey
import org.apache.xml.security.algorithms.JCEMapper; //导入依赖的package包/类
public static SecretKey prepareSecretKey(String symEncAlgo, byte[] rawKey) {
SecretKeySpec keySpec =
new SecretKeySpec(rawKey, JCEMapper.getJCEKeyAlgorithmFromURI(symEncAlgo));
return (SecretKey) keySpec;
}
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:6,代码来源:WSSecurityUtil.java
示例17: generateKeyFromURI
import org.apache.xml.security.algorithms.JCEMapper; //导入依赖的package包/类
/**
* Randomly generates a Java JCE symmetric Key object from the specified XML Encryption algorithm URI.
*
* @param algoURI The XML Encryption algorithm URI
* @return a randomly-generated symmteric key
* @throws NoSuchProviderException provider not found
* @throws NoSuchAlgorithmException algorithm not found
*/
public static SecretKey generateKeyFromURI(String algoURI)
throws NoSuchAlgorithmException, NoSuchProviderException {
String jceAlgorithmName = JCEMapper.getJCEKeyAlgorithmFromURI(algoURI);
int keyLength = JCEMapper.getKeyLengthFromURI(algoURI);
return generateKey(jceAlgorithmName, keyLength, null);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:SecurityHelper.java
示例18: getAlgorithmIDFromURI
import org.apache.xml.security.algorithms.JCEMapper; //导入依赖的package包/类
/**
* Get the Java security JCA/JCE algorithm identifier associated with an algorithm URI.
*
* @param algorithmURI the algorithm URI to evaluate
* @return the Java algorithm identifier, or null if the mapping is unavailable or indeterminable from the URI
*/
public static String getAlgorithmIDFromURI(String algorithmURI) {
return DatatypeHelper.safeTrimOrNullString(JCEMapper.translateURItoJCEID(algorithmURI));
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:SecurityHelper.java
示例19: isHMAC
import org.apache.xml.security.algorithms.JCEMapper; //导入依赖的package包/类
/**
* Check whether the signature method algorithm URI indicates HMAC.
*
* @param signatureAlgorithm the signature method algorithm URI
* @return true if URI indicates HMAC, false otherwise
*/
public static boolean isHMAC(String signatureAlgorithm) {
String algoClass = DatatypeHelper.safeTrimOrNullString(JCEMapper.getAlgorithmClassFromURI(signatureAlgorithm));
return ApacheXMLSecurityConstants.ALGO_CLASS_MAC.equals(algoClass);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:SecurityHelper.java
示例20: generateKeyPairFromURI
import org.apache.xml.security.algorithms.JCEMapper; //导入依赖的package包/类
/**
* Randomly generates a Java JCE KeyPair object from the specified XML Encryption algorithm URI.
*
* @param algoURI The XML Encryption algorithm URI
* @param keyLength the length of key to generate
* @return a randomly-generated KeyPair
* @throws NoSuchProviderException provider not found
* @throws NoSuchAlgorithmException algorithm not found
*/
public static KeyPair generateKeyPairFromURI(String algoURI, int keyLength)
throws NoSuchAlgorithmException, NoSuchProviderException {
String jceAlgorithmName = JCEMapper.getJCEKeyAlgorithmFromURI(algoURI);
return generateKeyPair(jceAlgorithmName, keyLength, null);
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:SecurityHelper.java
注:本文中的org.apache.xml.security.algorithms.JCEMapper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论