本文整理汇总了Java中com.sun.org.apache.xml.internal.security.encryption.XMLCipher.loadEncryptedKey方法的典型用法代码示例。如果您正苦于以下问题:Java XMLCipher.loadEncryptedKey方法的具体用法?Java XMLCipher.loadEncryptedKey怎么用?Java XMLCipher.loadEncryptedKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.org.apache.xml.internal.security.encryption.XMLCipher
的用法示例。
在下文中一共展示了XMLCipher.loadEncryptedKey方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: itemEncryptedKey
import com.sun.org.apache.xml.internal.security.encryption.XMLCipher; //导入方法依赖的package包/类
/**
* Method itemEncryptedKey
*
* @param i
* @return the asked EncryptedKey element, null if the index is too big
* @throws XMLSecurityException
*/
public EncryptedKey itemEncryptedKey(int i) throws XMLSecurityException {
if (encryptedKeys != null) {
return encryptedKeys.get(i);
}
Element e =
XMLUtils.selectXencNode(
this.constructionElement.getFirstChild(), EncryptionConstants._TAG_ENCRYPTEDKEY, i);
if (e != null) {
XMLCipher cipher = XMLCipher.getInstance();
cipher.init(XMLCipher.UNWRAP_MODE, null);
return cipher.loadEncryptedKey(e);
}
return null;
}
示例2: itemEncryptedKey
import com.sun.org.apache.xml.internal.security.encryption.XMLCipher; //导入方法依赖的package包/类
/**
* Method itemEncryptedKey
*
* @param i
* @return the asked EncryptedKey element, null if the index is too big
* @throws XMLSecurityException
*/
public EncryptedKey itemEncryptedKey(int i) throws XMLSecurityException {
if (encryptedKeys!=null) {
return (EncryptedKey) encryptedKeys.get(i);
}
Element e =
XMLUtils.selectXencNode(this._constructionElement.getFirstChild(),
EncryptionConstants._TAG_ENCRYPTEDKEY,i);
if (e != null) {
XMLCipher cipher = XMLCipher.getInstance();
cipher.init(XMLCipher.UNWRAP_MODE, null);
return cipher.loadEncryptedKey(e);
}
return null;
}
示例3: itemEncryptedKey
import com.sun.org.apache.xml.internal.security.encryption.XMLCipher; //导入方法依赖的package包/类
/**
* Method itemEncryptedKey
*
* @param i
* @return the asked EncryptedKey element, null if the index is too big
* @throws XMLSecurityException
*/
public EncryptedKey itemEncryptedKey(int i) throws XMLSecurityException {
if (encryptedKeys!=null) {
return encryptedKeys.get(i);
}
Element e =
XMLUtils.selectXencNode(this._constructionElement.getFirstChild(),
EncryptionConstants._TAG_ENCRYPTEDKEY,i);
if (e != null) {
XMLCipher cipher = XMLCipher.getInstance();
cipher.init(XMLCipher.UNWRAP_MODE, null);
return cipher.loadEncryptedKey(e);
}
return null;
}
示例4: engineLookupAndResolveSecretKey
import com.sun.org.apache.xml.internal.security.encryption.XMLCipher; //导入方法依赖的package包/类
/** @inheritDoc */
public javax.crypto.SecretKey engineLookupAndResolveSecretKey(
Element element, String BaseURI, StorageResolver storage
) {
if (log.isLoggable(java.util.logging.Level.FINE)) {
log.log(java.util.logging.Level.FINE, "EncryptedKeyResolver - Can I resolve " + element.getTagName());
}
if (element == null) {
return null;
}
SecretKey key = null;
boolean isEncryptedKey =
XMLUtils.elementIsInEncryptionSpace(element, EncryptionConstants._TAG_ENCRYPTEDKEY);
if (isEncryptedKey) {
if (log.isLoggable(java.util.logging.Level.FINE)) {
log.log(java.util.logging.Level.FINE, "Passed an Encrypted Key");
}
try {
XMLCipher cipher = XMLCipher.getInstance();
cipher.init(XMLCipher.UNWRAP_MODE, kek);
if (internalKeyResolvers != null) {
int size = internalKeyResolvers.size();
for (int i = 0; i < size; i++) {
cipher.registerInternalKeyResolver(internalKeyResolvers.get(i));
}
}
EncryptedKey ek = cipher.loadEncryptedKey(element);
key = (SecretKey) cipher.decryptKey(ek, algorithm);
} catch (XMLEncryptionException e) {
if (log.isLoggable(java.util.logging.Level.FINE)) {
log.log(java.util.logging.Level.FINE, e.getMessage(), e);
}
}
}
return key;
}
示例5: engineLookupAndResolveSecretKey
import com.sun.org.apache.xml.internal.security.encryption.XMLCipher; //导入方法依赖的package包/类
/** @inheritDoc */
public javax.crypto.SecretKey engineLookupAndResolveSecretKey(
Element element, String BaseURI, StorageResolver storage) {
SecretKey key=null;
if (log.isLoggable(java.util.logging.Level.FINE))
log.log(java.util.logging.Level.FINE, "EncryptedKeyResolver - Can I resolve " + element.getTagName());
if (element == null) {
return null;
}
boolean isEncryptedKey = XMLUtils.elementIsInEncryptionSpace(element,
EncryptionConstants._TAG_ENCRYPTEDKEY);
if (isEncryptedKey) {
log.log(java.util.logging.Level.FINE, "Passed an Encrypted Key");
try {
XMLCipher cipher = XMLCipher.getInstance();
cipher.init(XMLCipher.UNWRAP_MODE, _kek);
EncryptedKey ek = cipher.loadEncryptedKey(element);
key = (SecretKey) cipher.decryptKey(ek, _algorithm);
}
catch (Exception e) {}
}
return key;
}