本文整理汇总了Java中com.sun.org.apache.xml.internal.security.algorithms.JCEMapper类的典型用法代码示例。如果您正苦于以下问题:Java JCEMapper类的具体用法?Java JCEMapper怎么用?Java JCEMapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JCEMapper类属于com.sun.org.apache.xml.internal.security.algorithms包,在下文中一共展示了JCEMapper类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: IntegrityHmac
import com.sun.org.apache.xml.internal.security.algorithms.JCEMapper; //导入依赖的package包/类
/**
* Method IntegrityHmacSHA1das
*
* @throws XMLSignatureException
*/
public IntegrityHmac() throws XMLSignatureException {
String algorithmID = JCEMapper.translateURItoJCEID(this.engineGetURI());
if (log.isLoggable(java.util.logging.Level.FINE))
log.log(java.util.logging.Level.FINE, "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:openjdk,项目名称:jdk7-jdk,代码行数:21,代码来源:IntegrityHmac.java
示例2: constructCipher
import com.sun.org.apache.xml.internal.security.algorithms.JCEMapper; //导入依赖的package包/类
/**
* Construct a Cipher object
*/
private Cipher constructCipher(String algorithm, String digestAlgorithm) throws XMLEncryptionException {
String jceAlgorithm = JCEMapper.translateURItoJCEID(algorithm);
if (log.isLoggable(java.util.logging.Level.FINE)) {
log.log(java.util.logging.Level.FINE, "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:SunburstApps,项目名称:OpenJSharp,代码行数:43,代码来源:XMLCipher.java
示例3: IntegrityHmac
import com.sun.org.apache.xml.internal.security.algorithms.JCEMapper; //导入依赖的package包/类
/**
* Method IntegrityHmac
*
* @throws XMLSignatureException
*/
public IntegrityHmac() throws XMLSignatureException {
String algorithmID = JCEMapper.translateURItoJCEID(this.engineGetURI());
if (log.isLoggable(java.util.logging.Level.FINE)) {
log.log(java.util.logging.Level.FINE, "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:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:IntegrityHmac.java
示例4: getInstance
import com.sun.org.apache.xml.internal.security.algorithms.JCEMapper; //导入依赖的package包/类
public static XMLCipher getInstance(String transformation,Cipher cipher) throws XMLEncryptionException {
// sanity checks
logger.log(java.util.logging.Level.FINE, "Getting XMLCipher...");
if (null == transformation)
logger.log(java.util.logging.Level.SEVERE, "Transformation unexpectedly null...");
if(!isValidEncryptionAlgorithm(transformation))
logger.log(java.util.logging.Level.WARNING, "Algorithm non-standard, expected one of " + ENC_ALGORITHMS);
XMLCipher instance = new XMLCipher();
instance._algorithm = transformation;
instance._key = null;
instance._kek = null;
/* Create a canonicaliser - used when serialising DOM to octets
* prior to encryption (and for the reverse) */
try {
instance._canon = Canonicalizer.getInstance
(Canonicalizer.ALGO_ID_C14N_WITH_COMMENTS);
} catch (InvalidCanonicalizerException ice) {
throw new XMLEncryptionException("empty", ice);
}
String jceAlgorithm = JCEMapper.translateURItoJCEID(transformation);
try {
instance._contextCipher = cipher;
//Cipher.getInstance(jceAlgorithm);
logger.log(java.util.logging.Level.FINE, "cihper.algoritm = " +
instance._contextCipher.getAlgorithm());
}catch(Exception ex) {
throw new XMLEncryptionException("empty", ex);
}
return (instance);
}
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:40,代码来源:XMLCipher.java
示例5: dynamicInit
import com.sun.org.apache.xml.internal.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.isLoggable(java.util.logging.Level.FINE)) {
log.log(java.util.logging.Level.FINE, "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.log(java.util.logging.Level.SEVERE, xse.getMessage(), xse);
xse.printStackTrace();
}
}
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:62,代码来源:Init.java
示例6: getProviderInstance
import com.sun.org.apache.xml.internal.security.algorithms.JCEMapper; //导入依赖的package包/类
/**
* Returns an <code>XMLCipher</code> that implements the specified
* transformation and operates on the specified context document.
*
* @param transformation the name of the transformation, e.g.,
* <code>XMLCipher.TRIPLEDES</code> which is shorthand for
* "http://www.w3.org/2001/04/xmlenc#tripledes-cbc"
* @param provider the JCE provider that supplies the transformation
* @return the XMLCipher
* @throws XMLEncryptionException
*/
public static XMLCipher getProviderInstance(String transformation, String provider)
throws XMLEncryptionException {
// sanity checks
logger.log(java.util.logging.Level.FINE, "Getting XMLCipher...");
if (null == transformation)
logger.log(java.util.logging.Level.SEVERE, "Transformation unexpectedly null...");
if(null == provider)
logger.log(java.util.logging.Level.SEVERE, "Provider unexpectedly null..");
if("" == provider)
logger.log(java.util.logging.Level.SEVERE, "Provider's value unexpectedly not specified...");
if(!isValidEncryptionAlgorithm(transformation))
logger.log(java.util.logging.Level.WARNING, "Algorithm non-standard, expected one of " + ENC_ALGORITHMS);
XMLCipher instance = new XMLCipher();
instance._algorithm = transformation;
instance._requestedJCEProvider = provider;
instance._key = null;
instance._kek = null;
/* Create a canonicaliser - used when serialising DOM to octets
* prior to encryption (and for the reverse) */
try {
instance._canon = Canonicalizer.getInstance
(Canonicalizer.ALGO_ID_C14N_WITH_COMMENTS);
} catch (InvalidCanonicalizerException ice) {
throw new XMLEncryptionException("empty", ice);
}
try {
String jceAlgorithm =
JCEMapper.translateURItoJCEID(transformation);
instance._contextCipher = Cipher.getInstance(jceAlgorithm, provider);
logger.log(java.util.logging.Level.FINE, "cipher._algorithm = " +
instance._contextCipher.getAlgorithm());
logger.log(java.util.logging.Level.FINE, "provider.name = " + provider);
} catch (NoSuchAlgorithmException nsae) {
throw new XMLEncryptionException("empty", nsae);
} catch (NoSuchProviderException nspre) {
throw new XMLEncryptionException("empty", nspre);
} catch (NoSuchPaddingException nspe) {
throw new XMLEncryptionException("empty", nspe);
}
return (instance);
}
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:62,代码来源:XMLCipher.java
示例7: dynamicInit
import com.sun.org.apache.xml.internal.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.isLoggable(java.util.logging.Level.FINE)) {
log.log(java.util.logging.Level.FINE, "Registering default algorithms");
}
try {
//
// 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();
} catch (Exception ex) {
log.log(java.util.logging.Level.SEVERE, ex.getMessage(), ex);
ex.printStackTrace();
}
}
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:55,代码来源:Init.java
注:本文中的com.sun.org.apache.xml.internal.security.algorithms.JCEMapper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论