Class CMSTestUtil


  • public class CMSTestUtil
    extends java.lang.Object
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static javax.crypto.KeyGenerator aes192kg  
      static javax.crypto.KeyGenerator aesKg  
      static javax.crypto.KeyGenerator camelliaKg  
      static boolean DEBUG  
      static javax.crypto.KeyGenerator desede128kg  
      static javax.crypto.KeyGenerator desede192kg  
      static java.security.KeyPairGenerator dhKpg  
      static java.security.KeyPairGenerator dsaKpg  
      static java.security.KeyPairGenerator ecDsaKpg  
      static java.security.KeyPairGenerator ecGostKpg  
      static java.security.KeyPairGenerator ed25519Kpg  
      static java.security.KeyPairGenerator ed448Kpg  
      static java.security.KeyPairGenerator gostKpg  
      static java.security.KeyPairGenerator kpg  
      static java.security.SecureRandom rand  
      static javax.crypto.KeyGenerator rc2128kg  
      static javax.crypto.KeyGenerator rc240kg  
      static javax.crypto.KeyGenerator rc264kg  
      static javax.crypto.KeyGenerator seedKg  
      static java.math.BigInteger serialNumber  
    • Constructor Summary

      Constructors 
      Constructor Description
      CMSTestUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String dumpBase64​(byte[] data)  
      static X509AttributeCertificateHolder getAttributeCertificate()  
      static javax.crypto.SecretKey makeAES192Key()  
      static javax.crypto.SecretKey makeAESKey​(int keySize)  
      static java.security.cert.X509Certificate makeCACertificate​(java.security.KeyPair _subKP, java.lang.String _subDN, java.security.KeyPair _issKP, java.lang.String _issDN)  
      static javax.crypto.SecretKey makeCamelliaKey​(int keySize)  
      static java.security.cert.X509Certificate makeCertificate​(java.security.KeyPair _subKP, java.lang.String _subDN, java.security.KeyPair _issKP, java.lang.String _issDN)  
      static java.security.cert.X509Certificate makeCertificate​(java.security.KeyPair subKP, java.lang.String _subDN, java.security.KeyPair issKP, java.lang.String _issDN, boolean _ca)  
      static java.security.cert.X509Certificate makeCertificate​(java.security.KeyPair subKP, java.lang.String _subDN, java.security.KeyPair issKP, java.lang.String _issDN, org.bouncycastle.asn1.x509.AlgorithmIdentifier keyAlgID)  
      static java.security.cert.X509CRL makeCrl​(java.security.KeyPair pair)  
      static javax.crypto.SecretKey makeDesede128Key()  
      static javax.crypto.SecretKey makeDesede192Key()  
      static java.security.KeyPair makeDhKeyPair()  
      static java.security.KeyPair makeDsaKeyPair()  
      static java.security.KeyPair makeEcDsaKeyPair()  
      static java.security.KeyPair makeEcGostKeyPair()  
      static java.security.KeyPair makeEd25519KeyPair()  
      static java.security.KeyPair makeEd448KeyPair()  
      static java.security.KeyPair makeGostKeyPair()  
      static java.security.KeyPair makeKeyPair()  
      static java.security.cert.X509Certificate makeOaepCertificate​(java.security.KeyPair _subKP, java.lang.String _subDN, java.security.KeyPair _issKP, java.lang.String _issDN)  
      static java.security.cert.X509Certificate makeOaepCertificate​(java.security.KeyPair subKP, java.lang.String _subDN, java.security.KeyPair issKP, java.lang.String _issDN, boolean _ca)  
      static javax.crypto.SecretKey makeRC2128Key()  
      static javax.crypto.SecretKey makeRC240Key()  
      static javax.crypto.SecretKey makeRC264Key()  
      static javax.crypto.SecretKey makeSEEDKey()  
      static java.security.cert.X509Certificate makeV1Certificate​(java.security.KeyPair subKP, java.lang.String _subDN, java.security.KeyPair issKP, java.lang.String _issDN)  
      static byte[] streamToByteArray​(java.io.InputStream in)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • rand

        public static java.security.SecureRandom rand
      • kpg

        public static java.security.KeyPairGenerator kpg
      • gostKpg

        public static java.security.KeyPairGenerator gostKpg
      • dsaKpg

        public static java.security.KeyPairGenerator dsaKpg
      • dhKpg

        public static java.security.KeyPairGenerator dhKpg
      • ecGostKpg

        public static java.security.KeyPairGenerator ecGostKpg
      • ecDsaKpg

        public static java.security.KeyPairGenerator ecDsaKpg
      • ed25519Kpg

        public static java.security.KeyPairGenerator ed25519Kpg
      • ed448Kpg

        public static java.security.KeyPairGenerator ed448Kpg
      • aes192kg

        public static javax.crypto.KeyGenerator aes192kg
      • desede128kg

        public static javax.crypto.KeyGenerator desede128kg
      • desede192kg

        public static javax.crypto.KeyGenerator desede192kg
      • rc240kg

        public static javax.crypto.KeyGenerator rc240kg
      • rc264kg

        public static javax.crypto.KeyGenerator rc264kg
      • rc2128kg

        public static javax.crypto.KeyGenerator rc2128kg
      • aesKg

        public static javax.crypto.KeyGenerator aesKg
      • seedKg

        public static javax.crypto.KeyGenerator seedKg
      • camelliaKg

        public static javax.crypto.KeyGenerator camelliaKg
      • serialNumber

        public static java.math.BigInteger serialNumber
    • Constructor Detail

      • CMSTestUtil

        public CMSTestUtil()
    • Method Detail

      • dumpBase64

        public static java.lang.String dumpBase64​(byte[] data)
      • getAttributeCertificate

        public static X509AttributeCertificateHolder getAttributeCertificate()
                                                                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • makeKeyPair

        public static java.security.KeyPair makeKeyPair()
      • makeGostKeyPair

        public static java.security.KeyPair makeGostKeyPair()
      • makeDsaKeyPair

        public static java.security.KeyPair makeDsaKeyPair()
      • makeEd25519KeyPair

        public static java.security.KeyPair makeEd25519KeyPair()
      • makeEd448KeyPair

        public static java.security.KeyPair makeEd448KeyPair()
      • makeEcDsaKeyPair

        public static java.security.KeyPair makeEcDsaKeyPair()
      • makeDhKeyPair

        public static java.security.KeyPair makeDhKeyPair()
      • makeEcGostKeyPair

        public static java.security.KeyPair makeEcGostKeyPair()
      • makeDesede128Key

        public static javax.crypto.SecretKey makeDesede128Key()
      • makeAES192Key

        public static javax.crypto.SecretKey makeAES192Key()
      • makeDesede192Key

        public static javax.crypto.SecretKey makeDesede192Key()
      • makeRC240Key

        public static javax.crypto.SecretKey makeRC240Key()
      • makeRC264Key

        public static javax.crypto.SecretKey makeRC264Key()
      • makeRC2128Key

        public static javax.crypto.SecretKey makeRC2128Key()
      • makeSEEDKey

        public static javax.crypto.SecretKey makeSEEDKey()
      • makeAESKey

        public static javax.crypto.SecretKey makeAESKey​(int keySize)
      • makeCamelliaKey

        public static javax.crypto.SecretKey makeCamelliaKey​(int keySize)
      • makeCertificate

        public static java.security.cert.X509Certificate makeCertificate​(java.security.KeyPair _subKP,
                                                                         java.lang.String _subDN,
                                                                         java.security.KeyPair _issKP,
                                                                         java.lang.String _issDN)
                                                                  throws java.security.GeneralSecurityException,
                                                                         java.io.IOException,
                                                                         OperatorCreationException
        Throws:
        java.security.GeneralSecurityException
        java.io.IOException
        OperatorCreationException
      • makeOaepCertificate

        public static java.security.cert.X509Certificate makeOaepCertificate​(java.security.KeyPair _subKP,
                                                                             java.lang.String _subDN,
                                                                             java.security.KeyPair _issKP,
                                                                             java.lang.String _issDN)
                                                                      throws java.security.GeneralSecurityException,
                                                                             java.io.IOException,
                                                                             OperatorCreationException
        Throws:
        java.security.GeneralSecurityException
        java.io.IOException
        OperatorCreationException
      • makeCACertificate

        public static java.security.cert.X509Certificate makeCACertificate​(java.security.KeyPair _subKP,
                                                                           java.lang.String _subDN,
                                                                           java.security.KeyPair _issKP,
                                                                           java.lang.String _issDN)
                                                                    throws java.security.GeneralSecurityException,
                                                                           java.io.IOException,
                                                                           OperatorCreationException
        Throws:
        java.security.GeneralSecurityException
        java.io.IOException
        OperatorCreationException
      • makeV1Certificate

        public static java.security.cert.X509Certificate makeV1Certificate​(java.security.KeyPair subKP,
                                                                           java.lang.String _subDN,
                                                                           java.security.KeyPair issKP,
                                                                           java.lang.String _issDN)
                                                                    throws java.security.GeneralSecurityException,
                                                                           java.io.IOException,
                                                                           OperatorCreationException
        Throws:
        java.security.GeneralSecurityException
        java.io.IOException
        OperatorCreationException
      • makeCertificate

        public static java.security.cert.X509Certificate makeCertificate​(java.security.KeyPair subKP,
                                                                         java.lang.String _subDN,
                                                                         java.security.KeyPair issKP,
                                                                         java.lang.String _issDN,
                                                                         boolean _ca)
                                                                  throws java.security.GeneralSecurityException,
                                                                         java.io.IOException,
                                                                         OperatorCreationException
        Throws:
        java.security.GeneralSecurityException
        java.io.IOException
        OperatorCreationException
      • makeCertificate

        public static java.security.cert.X509Certificate makeCertificate​(java.security.KeyPair subKP,
                                                                         java.lang.String _subDN,
                                                                         java.security.KeyPair issKP,
                                                                         java.lang.String _issDN,
                                                                         org.bouncycastle.asn1.x509.AlgorithmIdentifier keyAlgID)
                                                                  throws java.security.GeneralSecurityException,
                                                                         java.io.IOException,
                                                                         OperatorCreationException
        Throws:
        java.security.GeneralSecurityException
        java.io.IOException
        OperatorCreationException
      • makeOaepCertificate

        public static java.security.cert.X509Certificate makeOaepCertificate​(java.security.KeyPair subKP,
                                                                             java.lang.String _subDN,
                                                                             java.security.KeyPair issKP,
                                                                             java.lang.String _issDN,
                                                                             boolean _ca)
                                                                      throws java.security.GeneralSecurityException,
                                                                             java.io.IOException,
                                                                             OperatorCreationException
        Throws:
        java.security.GeneralSecurityException
        java.io.IOException
        OperatorCreationException
      • makeCrl

        public static java.security.cert.X509CRL makeCrl​(java.security.KeyPair pair)
                                                  throws java.lang.Exception
        Throws:
        java.lang.Exception
      • streamToByteArray

        public static byte[] streamToByteArray​(java.io.InputStream in)
                                        throws java.io.IOException
        Throws:
        java.io.IOException