本文整理了Java中org.spongycastle.asn1.x509.AlgorithmIdentifier
类的一些代码示例,展示了AlgorithmIdentifier
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AlgorithmIdentifier
类的具体详情如下:
包路径:org.spongycastle.asn1.x509.AlgorithmIdentifier
类名称:AlgorithmIdentifier
暂无
代码示例来源:origin: com.madgag.spongycastle/bcpkix-jdk15on
AlgorithmIdentifier fixAlgID(AlgorithmIdentifier algId)
{
if (algId.getParameters() == null)
{
return new AlgorithmIdentifier(algId.getAlgorithm(), DERNull.INSTANCE);
}
return algId;
}
代码示例来源:origin: com.madgag.spongycastle/core
private EncryptionScheme(
ASN1Sequence seq)
{
this.algId = AlgorithmIdentifier.getInstance(seq);
}
代码示例来源:origin: com.madgag.spongycastle/prov
private void writeObject(
ObjectOutputStream out)
throws IOException
{
out.defaultWriteObject();
if (!algorithmIdentifier.equals(DEFAULT_ALGORITHM_IDENTIFIER))
{
out.writeObject(algorithmIdentifier.getEncoded());
}
}
}
代码示例来源:origin: com.madgag.spongycastle/bcpkix-jdk15on
public AlgorithmIdentifier getDigestAlgorithmIdentifier()
{
return new AlgorithmIdentifier(algorithmIdentifier.getAlgorithm(), DERNull.INSTANCE);
}
};
代码示例来源:origin: com.madgag.spongycastle/core
public EncryptionScheme(
ASN1ObjectIdentifier objectId,
ASN1Encodable parameters)
{
this.algId = new AlgorithmIdentifier(objectId, parameters);
}
代码示例来源:origin: com.madgag.spongycastle/pkix
public MacCalculator build(final char[] password)
throws OperatorCreationException
{
PKCS12PBEParams pbeParams = PKCS12PBEParams.getInstance(algorithmIdentifier.getParameters());
return PKCS12PBEUtils.createMacCalculator(algorithmIdentifier.getAlgorithm(), digestProvider.get(algorithmIdentifier), pbeParams, password);
}
代码示例来源:origin: com.madgag.spongycastle/pkix
/**
* return the object identifier for the key encryption algorithm.
*
* @return OID for key encryption algorithm.
*/
public String getKeyEncryptionAlgOID()
{
return keyEncAlg.getAlgorithm().getId();
}
代码示例来源:origin: com.madgag.spongycastle/bcpkix-jdk15on
protected RecipientOperator getRecipientOperator(Recipient recipient)
throws CMSException, IOException
{
PasswordRecipient pbeRecipient = (PasswordRecipient)recipient;
AlgorithmIdentifier kekAlg = AlgorithmIdentifier.getInstance(info.getKeyEncryptionAlgorithm());
AlgorithmIdentifier kekAlgParams = AlgorithmIdentifier.getInstance(kekAlg.getParameters());
int keySize = ((Integer)KEYSIZES.get(kekAlgParams.getAlgorithm())).intValue();
byte[] derivedKey = pbeRecipient.calculateDerivedKey(pbeRecipient.getPasswordConversionScheme(), this.getKeyDerivationAlgorithm(), keySize);
return pbeRecipient.getRecipientOperator(kekAlgParams, messageAlgorithm, derivedKey, info.getEncryptedKey().getOctets());
}
}
代码示例来源:origin: com.madgag.spongycastle/core
public ASN1Encodable getParameters()
{
return algId.getParameters();
}
代码示例来源:origin: com.madgag.spongycastle/core
/**
* Return true if the PRF is the default (hmacWithSHA1)
*
* @return true if PRF is default, false otherwise.
*/
public boolean isDefaultPrf()
{
return prf == null || prf.equals(algid_hmacWithSHA1);
}
代码示例来源:origin: com.madgag.spongycastle/bcpkix-jdk15on
public AlgorithmIdentifier find(String digAlgName)
{
return new AlgorithmIdentifier((ASN1ObjectIdentifier)digestNameToOids.get(digAlgName), DERNull.INSTANCE);
}
}
代码示例来源:origin: com.madgag.spongycastle/bcpkix-jdk15on
public MacCalculator build(final char[] password)
throws OperatorCreationException
{
PKCS12PBEParams pbeParams = PKCS12PBEParams.getInstance(algorithmIdentifier.getParameters());
return PKCS12PBEUtils.createMacCalculator(algorithmIdentifier.getAlgorithm(), digestProvider.get(algorithmIdentifier), pbeParams, password);
}
代码示例来源:origin: com.madgag.spongycastle/pkix
/**
* return the object identifier for the signature.
*/
public String getEncryptionAlgOID()
{
return encryptionAlgorithm.getAlgorithm().getId();
}
代码示例来源:origin: com.madgag.spongycastle/pkix
protected RecipientOperator getRecipientOperator(Recipient recipient)
throws CMSException, IOException
{
PasswordRecipient pbeRecipient = (PasswordRecipient)recipient;
AlgorithmIdentifier kekAlg = AlgorithmIdentifier.getInstance(info.getKeyEncryptionAlgorithm());
AlgorithmIdentifier kekAlgParams = AlgorithmIdentifier.getInstance(kekAlg.getParameters());
int keySize = ((Integer)KEYSIZES.get(kekAlgParams.getAlgorithm())).intValue();
byte[] derivedKey = pbeRecipient.calculateDerivedKey(pbeRecipient.getPasswordConversionScheme(), this.getKeyDerivationAlgorithm(), keySize);
return pbeRecipient.getRecipientOperator(kekAlgParams, messageAlgorithm, derivedKey, info.getEncryptedKey().getOctets());
}
}
代码示例来源:origin: com.madgag.spongycastle/pkix
public byte[] calculateDerivedKey(int schemeID, AlgorithmIdentifier derivationAlgorithm, int keySize)
throws CMSException
{
PBKDF2Params params = PBKDF2Params.getInstance(derivationAlgorithm.getParameters());
byte[] encodedPassword = (schemeID == PasswordRecipient.PKCS5_SCHEME2) ? PBEParametersGenerator.PKCS5PasswordToBytes(password) : PBEParametersGenerator.PKCS5PasswordToUTF8Bytes(password);
PKCS5S2ParametersGenerator gen = new PKCS5S2ParametersGenerator();
gen.init(encodedPassword, params.getSalt(), params.getIterationCount().intValue());
return ((KeyParameter)gen.generateDerivedParameters(keySize)).getKey();
}
代码示例来源:origin: com.madgag.spongycastle/prov
/**
* Return true if this spec is for the default PRF (HmacSHA1), false otherwise.
*
* @return true if this spec uses the default PRF, false otherwise.
*/
public boolean isDefaultPrf()
{
return defaultPRF.equals(prf);
}
代码示例来源:origin: com.madgag.spongycastle/pkix
AlgorithmIdentifier fixAlgID(AlgorithmIdentifier algId)
{
if (algId.getParameters() == null)
{
return new AlgorithmIdentifier(algId.getAlgorithm(), DERNull.INSTANCE);
}
return algId;
}
代码示例来源:origin: com.madgag.spongycastle/pkix
public JceKTSKeyWrapper(PublicKey publicKey, String symmetricWrappingAlg, int keySizeInBits, byte[] partyUInfo, byte[] partyVInfo)
{
super(new AlgorithmIdentifier(PKCSObjectIdentifiers.id_rsa_KEM, new GenericHybridParameters(new AlgorithmIdentifier(ISOIECObjectIdentifiers.id_kem_rsa, new RsaKemParameters(new AlgorithmIdentifier(X9ObjectIdentifiers.id_kdf_kdf3, new AlgorithmIdentifier(NISTObjectIdentifiers.id_sha256)), (keySizeInBits + 7) / 8)), JceSymmetricKeyWrapper.determineKeyEncAlg(symmetricWrappingAlg, keySizeInBits))));
this.publicKey = publicKey;
this.symmetricWrappingAlg = symmetricWrappingAlg;
this.keySizeInBits = keySizeInBits;
this.partyUInfo = Arrays.clone(partyUInfo);
this.partyVInfo = Arrays.clone(partyVInfo);
}
代码示例来源:origin: com.madgag.spongycastle/prov
static String getSignatureName(
AlgorithmIdentifier sigAlgId)
{
ASN1Encodable params = sigAlgId.getParameters();
if (params != null && !DERNull.INSTANCE.equals(params))
{
if (sigAlgId.getAlgorithm().equals(PKCSObjectIdentifiers.id_RSASSA_PSS))
{
RSASSAPSSparams rsaParams = RSASSAPSSparams.getInstance(params);
return getDigestAlgName(rsaParams.getHashAlgorithm().getAlgorithm()) + "withRSAandMGF1";
}
}
return sigAlgId.getAlgorithm().getId();
}
代码示例来源:origin: com.madgag.spongycastle/bcpkix-jdk15on
/**
* return the object identifier for the mac algorithm.
*/
public String getMacAlgOID()
{
return macAlg.getAlgorithm().toString();
}
内容来源于网络,如有侵权,请联系作者删除!