Class BCryptKdfOptions

    • Field Detail

      • DEFAULT_MAX_ROUNDS

        public static final int DEFAULT_MAX_ROUNDS
        Various discussions on the net seem to indicate that 64 is the value at which many computers seem to slow down noticeably, so we are rather generous here. The default value (unless overridden by the -a parameter to the ssh-keygen command) is usually 16.
        See Also:
        Constant Field Values
      • MAX_ROUNDS_HOLDER

        private static final java.util.concurrent.atomic.AtomicInteger MAX_ROUNDS_HOLDER
      • salt

        private byte[] salt
      • numRounds

        private int numRounds
    • Constructor Detail

      • BCryptKdfOptions

        public BCryptKdfOptions()
    • Method Detail

      • initialize

        public void initialize​(java.lang.String name,
                               byte[] kdfOptions)
                        throws java.io.IOException
        Specified by:
        initialize in interface OpenSSHKdfOptions
        Throws:
        java.io.IOException
      • initialize

        protected void initialize​(java.io.InputStream stream,
                                  int maxSaltSize)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • decodePrivateKeyBytes

        public byte[] decodePrivateKeyBytes​(SessionContext session,
                                            NamedResource resourceKey,
                                            java.lang.String cipherName,
                                            byte[] privateDataBytes,
                                            java.lang.String password)
                                     throws java.io.IOException,
                                            java.security.GeneralSecurityException
        Specified by:
        decodePrivateKeyBytes in interface OpenSSHKeyDecryptor
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException
      • bcryptKdf

        protected void bcryptKdf​(byte[] password,
                                 byte[] output)
                          throws java.io.IOException,
                                 java.security.GeneralSecurityException
        Throws:
        java.io.IOException
        java.security.GeneralSecurityException
      • getName

        public final java.lang.String getName()
        Specified by:
        getName in interface NamedResource
        Returns:
        The resource name
      • getSalt

        public byte[] getSalt()
      • setSalt

        public void setSalt​(byte[] salt)
      • getNumRounds

        public int getNumRounds()
      • setNumRounds

        public void setNumRounds​(int numRounds)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getMaxAllowedRounds

        public static int getMaxAllowedRounds()
      • setMaxAllowedRounds

        public static void setMaxAllowedRounds​(int value)