Package org.bouncycastle.cms.jcajce
Class JcePasswordRecipient
- java.lang.Object
-
- org.bouncycastle.cms.AbstractRecipient
-
- org.bouncycastle.cms.jcajce.JcePasswordRecipient
-
- All Implemented Interfaces:
PasswordRecipient,Recipient
- Direct Known Subclasses:
JcePasswordAuthenticatedRecipient,JcePasswordAuthEnvelopedRecipient,JcePasswordEnvelopedRecipient
public abstract class JcePasswordRecipient extends AbstractRecipient implements PasswordRecipient
the RecipientInfo class for a recipient who has been sent a message encrypted using a password.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.bouncycastle.cms.PasswordRecipient
PasswordRecipient.PRF
-
-
Field Summary
Fields Modifier and Type Field Description protected EnvelopedDataHelperhelper-
Fields inherited from interface org.bouncycastle.cms.PasswordRecipient
PKCS5_SCHEME2, PKCS5_SCHEME2_UTF8
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]calculateDerivedKey(int schemeID, org.bouncycastle.asn1.x509.AlgorithmIdentifier derivationAlgorithm, int keySize)protected java.security.KeyextractSecretKey(org.bouncycastle.asn1.x509.AlgorithmIdentifier keyEncryptionAlgorithm, org.bouncycastle.asn1.x509.AlgorithmIdentifier contentEncryptionAlgorithm, byte[] derivedKey, byte[] encryptedContentEncryptionKey)char[]getPassword()intgetPasswordConversionScheme()JcePasswordRecipientsetAllowedContentAlgorithms(java.util.Set<org.bouncycastle.asn1.ASN1ObjectIdentifier> allowedContentAlgorithms)Set the content-encryption algorithms this recipient is willing to unwrap a key for.JcePasswordRecipientsetMinimumTagSize(int tagSizeInBits)Set the minimum AEAD authentication tag size (in bits) this recipient will accept.JcePasswordRecipientsetPasswordConversionScheme(int schemeID)JcePasswordRecipientsetProvider(java.lang.String providerName)JcePasswordRecipientsetProvider(java.security.Provider provider)-
Methods inherited from class org.bouncycastle.cms.AbstractRecipient
checkTagSize, isContentAlgorithmAllowed, setAllowedContentAlgorithmSet, setMinimumTagSizeInBits
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.bouncycastle.cms.PasswordRecipient
getRecipientOperator
-
-
-
-
Field Detail
-
helper
protected EnvelopedDataHelper helper
-
-
Method Detail
-
setPasswordConversionScheme
public JcePasswordRecipient setPasswordConversionScheme(int schemeID)
-
setProvider
public JcePasswordRecipient setProvider(java.security.Provider provider)
-
setProvider
public JcePasswordRecipient setProvider(java.lang.String providerName)
-
setAllowedContentAlgorithms
public JcePasswordRecipient setAllowedContentAlgorithms(java.util.Set<org.bouncycastle.asn1.ASN1ObjectIdentifier> allowedContentAlgorithms)
Set the content-encryption algorithms this recipient is willing to unwrap a key for. When set, an attempt to recover content protected under any other algorithm is rejected, mitigating an attacker substituting a weaker content-encryption algorithm into the recipient info.- Parameters:
allowedContentAlgorithms- the set of permitted content-encryption algorithm OIDs.- Returns:
- this recipient.
-
setMinimumTagSize
public JcePasswordRecipient setMinimumTagSize(int tagSizeInBits)
Set the minimum AEAD authentication tag size (in bits) this recipient will accept. When set, an attempt to recover AuthEnvelopedData whose content algorithm carries a shorter tag is rejected, mitigating an attacker downgrading the tag to a weaker length.- Parameters:
tagSizeInBits- the minimum acceptable AEAD tag size, in bits.- Returns:
- this recipient.
-
extractSecretKey
protected java.security.Key extractSecretKey(org.bouncycastle.asn1.x509.AlgorithmIdentifier keyEncryptionAlgorithm, org.bouncycastle.asn1.x509.AlgorithmIdentifier contentEncryptionAlgorithm, byte[] derivedKey, byte[] encryptedContentEncryptionKey) throws CMSException- Throws:
CMSException
-
calculateDerivedKey
public byte[] calculateDerivedKey(int schemeID, org.bouncycastle.asn1.x509.AlgorithmIdentifier derivationAlgorithm, int keySize) throws CMSException- Specified by:
calculateDerivedKeyin interfacePasswordRecipient- Throws:
CMSException
-
getPasswordConversionScheme
public int getPasswordConversionScheme()
- Specified by:
getPasswordConversionSchemein interfacePasswordRecipient
-
getPassword
public char[] getPassword()
- Specified by:
getPasswordin interfacePasswordRecipient
-
-