当前位置: 首页>>代码示例>>Java>>正文


Java Credential.getSecretKey方法代码示例

本文整理汇总了Java中org.opensaml.xml.security.credential.Credential.getSecretKey方法的典型用法代码示例。如果您正苦于以下问题:Java Credential.getSecretKey方法的具体用法?Java Credential.getSecretKey怎么用?Java Credential.getSecretKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opensaml.xml.security.credential.Credential的用法示例。


在下文中一共展示了Credential.getSecretKey方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: extractKeyValue

import org.opensaml.xml.security.credential.Credential; //导入方法依赖的package包/类
/**
 * Utility method to extract any key that might be present in the specified Credential.
 * 
 * @param cred the Credential to evaluate
 * @return the Key contained in the credential, or null if it does not contain a key.
 */
protected Key extractKeyValue(Credential cred) {
    if (cred == null) {
        return null;
    }
    if (cred.getPublicKey() != null) {
        return cred.getPublicKey();
    }
    // This could happen if key is derived, e.g. key agreement, etc
    if (cred.getSecretKey() != null) {
        return cred.getSecretKey();
    }
    // Perhaps unlikely, but go ahead and check
    if (cred.getPrivateKey() != null) {
        return cred.getPrivateKey();
    }
    return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:BasicProviderKeyInfoCredentialResolver.java

示例2: extractKeyValue

import org.opensaml.xml.security.credential.Credential; //导入方法依赖的package包/类
/**
 * Utility method to extract any key that might be present in the specified Credential.
 * 
 * @param cred the Credential to evaluate
 * @return the Key contained in the credential, or null if it does not contain a key.
 */
protected Key extractKeyValue(Credential cred) {
    if (cred == null) {
        return null;
    }
    if (cred.getPublicKey() != null) {
        return cred.getPublicKey();
    } 
    // This could happen if key is derived, e.g. key agreement, etc
    if (cred.getSecretKey() != null) {
        return cred.getSecretKey();
    }
    // Perhaps unlikely, but go ahead and check
    if (cred.getPrivateKey() != null) {
        return cred.getPrivateKey(); 
    }
    return null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:AbstractKeyInfoProvider.java

示例3: extractEncryptionKey

import org.opensaml.xml.security.credential.Credential; //导入方法依赖的package包/类
/**
 * Extract the encryption key from the credential.
 * 
 * @param credential the credential containing the encryption key
 * @return the encryption key (either a public key or a secret (symmetric) key
 */
public static Key extractEncryptionKey(Credential credential) {
    if (credential == null) {
        return null;
    }
    if (credential.getPublicKey() != null) {
        return credential.getPublicKey();
    } else {
        return credential.getSecretKey();
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:SecurityHelper.java

示例4: extractDecryptionKey

import org.opensaml.xml.security.credential.Credential; //导入方法依赖的package包/类
/**
 * Extract the decryption key from the credential.
 * 
 * @param credential the credential containing the decryption key
 * @return the decryption key (either a private key or a secret (symmetric) key
 */
public static Key extractDecryptionKey(Credential credential) {
    if (credential == null) {
        return null;
    }
    if (credential.getPrivateKey() != null) {
        return credential.getPrivateKey();
    } else {
        return credential.getSecretKey();
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:SecurityHelper.java

示例5: extractSigningKey

import org.opensaml.xml.security.credential.Credential; //导入方法依赖的package包/类
/**
 * Extract the signing key from the credential.
 * 
 * @param credential the credential containing the signing key
 * @return the signing key (either a private key or a secret (symmetric) key
 */
public static Key extractSigningKey(Credential credential) {
    if (credential == null) {
        return null;
    }
    if (credential.getPrivateKey() != null) {
        return credential.getPrivateKey();
    } else {
        return credential.getSecretKey();
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:SecurityHelper.java

示例6: extractVerificationKey

import org.opensaml.xml.security.credential.Credential; //导入方法依赖的package包/类
/**
 * Extract the verification key from the credential.
 * 
 * @param credential the credential containing the verification key
 * @return the verification key (either a public key or a secret (symmetric) key
 */
public static Key extractVerificationKey(Credential credential) {
    if (credential == null) {
        return null;
    }
    if (credential.getPublicKey() != null) {
        return credential.getPublicKey();
    } else {
        return credential.getSecretKey();
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:SecurityHelper.java

示例7: validate

import org.opensaml.xml.security.credential.Credential; //导入方法依赖的package包/类
/**
 * Evaluate trust.
 * 
 * @param untrustedCredential the untrusted credential to evaluate
 * @param trustedCredential basis for trust
 * @return true if trust can be established, false otherwise
 */
public boolean validate(Credential untrustedCredential, Credential trustedCredential) {

    Key untrustedKey = null;
    Key trustedKey = null;
    if (untrustedCredential.getPublicKey() != null) {
        untrustedKey = untrustedCredential.getPublicKey();
        trustedKey = trustedCredential.getPublicKey();
    } else {
        untrustedKey = untrustedCredential.getSecretKey();
        trustedKey = trustedCredential.getSecretKey();
    }
    if (untrustedKey == null) {
        log.debug("Untrusted credential contained no key, unable to evaluate");
        return false;
    } else if (trustedKey == null) {
        log.debug("Trusted credential contained no key of the appropriate type, unable to evaluate");
        return false;
    }

    if (validate(untrustedKey, trustedKey)) {
        log.debug("Successfully validated untrusted credential against trusted key");
        return true;
    }

    log.debug("Failed to validate untrusted credential against trusted key");
    return false;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:35,代码来源:ExplicitKeyTrustEvaluator.java

示例8: getKey

import org.opensaml.xml.security.credential.Credential; //导入方法依赖的package包/类
/**
 * Get the key contained within the credential.
 * 
 * @param credential the credential containing a key
 * @return the key from the credential
 */
private Key getKey(Credential credential) {
    if (credential.getPublicKey() != null) {
        return credential.getPublicKey();
    } else if (credential.getSecretKey() != null) {
        return credential.getSecretKey();
    } else if (credential.getPrivateKey() != null) {
        // There should have been a corresponding public key, but just in case...
        return credential.getPrivateKey();
    } else {
        return null;
    }

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:20,代码来源:EvaluableKeyLengthCredentialCriteria.java

示例9: isLocalCredential

import org.opensaml.xml.security.credential.Credential; //导入方法依赖的package包/类
/**
 * Determine whether the credential is a local credential.
 * 
 * A local credential will have either a private key or a secret (symmetric) key.
 * 
 * @param credential the credential to evaluate
 * @return true if the credential has either a private or secret key, false otherwise
 */
protected boolean isLocalCredential(Credential credential) {
    return credential.getPrivateKey() != null || credential.getSecretKey() != null;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:LocalKeyInfoCredentialResolver.java


注:本文中的org.opensaml.xml.security.credential.Credential.getSecretKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。