Class AuthCryptoProvider


  • public class AuthCryptoProvider
    extends AbstractCryptoProvider
    Version:
    February 12, 2019
    Author:
    Javier Rojas Blum, Yuriy Movchan
    • Field Detail

      • LOG

        protected static final org.apache.log4j.Logger LOG
    • Constructor Detail

      • AuthCryptoProvider

        public AuthCryptoProvider()
                           throws java.security.KeyStoreException
        Throws:
        java.security.KeyStoreException
      • AuthCryptoProvider

        public AuthCryptoProvider​(java.lang.String keyStoreFile,
                                  java.lang.String keyStoreSecret,
                                  java.lang.String dnName)
                           throws java.security.KeyStoreException
        Throws:
        java.security.KeyStoreException
      • AuthCryptoProvider

        public AuthCryptoProvider​(java.lang.String keyStoreFile,
                                  java.lang.String keyStoreSecret,
                                  java.lang.String dnName,
                                  boolean rejectNoneAlg)
                           throws java.security.KeyStoreException
        Throws:
        java.security.KeyStoreException
      • AuthCryptoProvider

        public AuthCryptoProvider​(java.lang.String keyStoreFile,
                                  java.lang.String keyStoreSecret,
                                  java.lang.String dnName,
                                  boolean rejectNoneAlg,
                                  KeySelectionStrategy keySelectionStrategy)
                           throws java.security.KeyStoreException
        Throws:
        java.security.KeyStoreException
    • Method Detail

      • load

        public void load​(java.lang.String keyStoreSecret)
      • getKeyStoreFile

        public java.lang.String getKeyStoreFile()
      • getKeyStoreSecret

        public java.lang.String getKeyStoreSecret()
      • getDnName

        public java.lang.String getDnName()
      • generateKey

        public org.json.JSONObject generateKey​(Algorithm algorithm,
                                               java.lang.Long expirationTime,
                                               Use use)
                                        throws java.security.NoSuchProviderException,
                                               java.security.NoSuchAlgorithmException,
                                               java.security.InvalidAlgorithmParameterException,
                                               java.security.cert.CertificateException,
                                               java.io.IOException,
                                               org.bouncycastle.operator.OperatorCreationException,
                                               java.security.KeyStoreException
        Specified by:
        generateKey in class AbstractCryptoProvider
        Throws:
        java.security.NoSuchProviderException
        java.security.NoSuchAlgorithmException
        java.security.InvalidAlgorithmParameterException
        java.security.cert.CertificateException
        java.io.IOException
        org.bouncycastle.operator.OperatorCreationException
        java.security.KeyStoreException
      • getAliasByAlgorithmForDeletion

        public java.lang.String getAliasByAlgorithmForDeletion​(Algorithm algorithm,
                                                               java.lang.String newAlias,
                                                               Use use)
                                                        throws java.security.KeyStoreException
        Throws:
        java.security.KeyStoreException
      • sign

        public java.lang.String sign​(java.lang.String signingInput,
                                     java.lang.String alias,
                                     java.lang.String sharedSecret,
                                     SignatureAlgorithm signatureAlgorithm)
                              throws java.lang.Exception
        Specified by:
        sign in class AbstractCryptoProvider
        Throws:
        java.lang.Exception
      • verifySignature

        public boolean verifySignature​(java.lang.String signingInput,
                                       java.lang.String encodedSignature,
                                       java.lang.String alias,
                                       org.json.JSONObject jwks,
                                       java.lang.String sharedSecret,
                                       SignatureAlgorithm signatureAlgorithm)
                                throws java.lang.Exception
        Specified by:
        verifySignature in class AbstractCryptoProvider
        Throws:
        java.lang.Exception
      • deleteKey

        public boolean deleteKey​(java.lang.String alias)
                          throws java.lang.Exception
        Specified by:
        deleteKey in class AbstractCryptoProvider
        Throws:
        java.lang.Exception
      • getPublicKey

        public java.security.PublicKey getPublicKey​(java.lang.String alias)
      • getPrivateKey

        public java.security.PrivateKey getPrivateKey​(java.lang.String alias)
                                               throws java.security.UnrecoverableKeyException,
                                                      java.security.NoSuchAlgorithmException,
                                                      java.security.KeyStoreException
        Specified by:
        getPrivateKey in class AbstractCryptoProvider
        Throws:
        java.security.UnrecoverableKeyException
        java.security.NoSuchAlgorithmException
        java.security.KeyStoreException
      • generateV3Certificate

        public java.security.cert.X509Certificate generateV3Certificate​(java.security.KeyPair keyPair,
                                                                        java.lang.String issuer,
                                                                        java.lang.String signatureAlgorithm,
                                                                        java.lang.Long expirationTime)
                                                                 throws org.bouncycastle.cert.CertIOException,
                                                                        org.bouncycastle.operator.OperatorCreationException,
                                                                        java.security.cert.CertificateException
        Throws:
        org.bouncycastle.cert.CertIOException
        org.bouncycastle.operator.OperatorCreationException
        java.security.cert.CertificateException
      • getSignatureAlgorithm

        public SignatureAlgorithm getSignatureAlgorithm​(java.lang.String alias)
                                                 throws java.security.KeyStoreException
        Throws:
        java.security.KeyStoreException
      • getKeyStore

        public java.security.KeyStore getKeyStore()