Class PublicKeyKeyEncryptionMethodGenerator

    • Field Detail

      • SESSION_KEY_OBFUSCATION_PROPERTY

        public static final java.lang.String SESSION_KEY_OBFUSCATION_PROPERTY
        See Also:
        Constant Field Values
      • WILDCARD

        public static final long WILDCARD
        Deprecated.
        use WILDCARD_KEYID
        See Also:
        Constant Field Values
      • WILDCARD_FINGERPRINT

        public static final byte[] WILDCARD_FINGERPRINT
      • sessionKeyObfuscation

        protected boolean sessionKeyObfuscation
      • useWildcardRecipient

        protected boolean useWildcardRecipient
    • Constructor Detail

      • PublicKeyKeyEncryptionMethodGenerator

        protected PublicKeyKeyEncryptionMethodGenerator​(PGPPublicKey pubKey)
    • Method Detail

      • setSessionKeyObfuscation

        public PublicKeyKeyEncryptionMethodGenerator setSessionKeyObfuscation​(boolean enabled)
        Controls whether to obfuscate the size of ECDH session keys using extra padding where necessary.

        The default behaviour can be configured using the system property "org.bouncycastle.openpgp.session_key_obfuscation", or else it will default to enabled.

        Returns:
        the current generator.
      • setUseWildcardKeyID

        @Deprecated
        public PublicKeyKeyEncryptionMethodGenerator setUseWildcardKeyID​(boolean enabled)
        Deprecated.
        use setUseWildcardRecipient(boolean) instead TODO: Remove in a future release
        Controls whether the recipient key ID/fingerprint is hidden (replaced by a wildcard value).
        Parameters:
        enabled - boolean
        Returns:
        this
      • setUseWildcardRecipient

        public PublicKeyKeyEncryptionMethodGenerator setUseWildcardRecipient​(boolean enabled)
        Controls whether the recipient key ID/fingerprint is hidden (replaced by a wildcard value).
        Parameters:
        enabled - boolean
        Returns:
        this
      • encodeEncryptedSessionInfo

        public byte[][] encodeEncryptedSessionInfo​(byte[] encryptedSessionInfo)
                                            throws PGPException
        Throws:
        PGPException
      • createSessionInfo

        protected byte[] createSessionInfo​(byte algorithm,
                                           byte[] keyBytes)
      • encryptSessionInfo

        protected abstract byte[] encryptSessionInfo​(PGPPublicKey pubKey,
                                                     byte[] sessionKey,
                                                     byte symAlgId,
                                                     boolean isV3)
                                              throws PGPException
        Encrypt a session key using the recipients public key.
        Parameters:
        pubKey - recipients public key
        sessionKey - session-key
        symAlgId - for v3: session key algorithm ID; for v6: 0
        Returns:
        encrypted session info
        Throws:
        PGPException
      • getSessionInfo

        protected static byte[] getSessionInfo​(byte[] ephPubEncoding,
                                               byte optSymKeyAlgorithm,
                                               byte[] wrappedSessionKey)