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


Java PGPPublicKey.getAlgorithm方法代码示例

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


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

示例1: PublicKeyKeyEncryptionMethodGenerator

import org.bouncycastle.openpgp.PGPPublicKey; //导入方法依赖的package包/类
protected PublicKeyKeyEncryptionMethodGenerator(
    PGPPublicKey pubKey)
{
    this.pubKey = pubKey;

    switch (pubKey.getAlgorithm())
    {
    case PGPPublicKey.RSA_ENCRYPT:
    case PGPPublicKey.RSA_GENERAL:
        break;
    case PGPPublicKey.RSA_SIGN:
        throw new IllegalArgumentException("Can't use an RSA_SIGN key for encryption.");
    case PGPPublicKey.ELGAMAL_ENCRYPT:
    case PGPPublicKey.ELGAMAL_GENERAL:
        break;
    case PGPPublicKey.ECDH:
        break;
    case PGPPublicKey.DSA:
        throw new IllegalArgumentException("Can't use DSA for encryption.");
    case PGPPublicKey.ECDSA:
        throw new IllegalArgumentException("Can't use ECDSA for encryption.");
    default:
        throw new IllegalArgumentException("unknown asymmetric algorithm: " + pubKey.getAlgorithm());
    }
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:26,代码来源:PublicKeyKeyEncryptionMethodGenerator.java

示例2: isForEncryption

import org.bouncycastle.openpgp.PGPPublicKey; //导入方法依赖的package包/类
/**
 * Can public key be used for encryption
 * @param key - Public key
 * @return true if public key has required type of subkeys for encryption else false
 */
private boolean isForEncryption(PGPPublicKey key){
    if (key.getAlgorithm() == PublicKeyAlgorithmTags.RSA_SIGN
        || key.getAlgorithm() == PublicKeyAlgorithmTags.DSA
        || key.getAlgorithm() == PublicKeyAlgorithmTags.ECDSA){
        return false;
    }

    return hasKeyFlags(key, KeyFlags.ENCRYPT_COMMS | KeyFlags.ENCRYPT_STORAGE);
}
 
开发者ID:ibm-messaging,项目名称:mq-mft,代码行数:15,代码来源:CryptDecryptUtil.java

示例3: isSigningKey

import org.bouncycastle.openpgp.PGPPublicKey; //导入方法依赖的package包/类
/** Returns {@code true} if this key can be used for signing. */
public static boolean isSigningKey(PGPPublicKey key) {
  switch (key.getAlgorithm()) {
    case RSA_GENERAL:
    case RSA_SIGN:
    case DSA:
    case ELGAMAL_GENERAL:
      return true;
    default:
      return false;
  }
}
 
开发者ID:google,项目名称:nomulus,代码行数:13,代码来源:PgpHelper.java

示例4: isSignatureKey

import org.bouncycastle.openpgp.PGPPublicKey; //导入方法依赖的package包/类
private static boolean isSignatureKey(PGPPublicKey key) {
    int algorithm = key.getAlgorithm();
    return algorithm == RSA_GENERAL || algorithm == RSA_SIGN || algorithm == DSA || algorithm == ECDSA || algorithm == ELGAMAL_GENERAL;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:5,代码来源:PGPDataFormatUtil.java


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