kz.gamma.jce
Class PKCS10CertificationRequest

java.lang.Object
  extended by kz.gamma.asn1.ASN1Encodable
      extended by kz.gamma.asn1.pkcs.CertificationRequest
          extended by kz.gamma.jce.PKCS10CertificationRequest
All Implemented Interfaces:
DEREncodable

public class PKCS10CertificationRequest
extends CertificationRequest

A class for verifying and creating PKCS10 Certification requests.

 CertificationRequest ::= SEQUENCE {
   certificationRequestInfo  CertificationRequestInfo,
   signatureAlgorithm        AlgorithmIdentifier{{ SignatureAlgorithms }},
   signature                 BIT STRING
 }
 

CertificationRequestInfo ::= SEQUENCE { version INTEGER { v1(0) } (v1,...), subject Name, subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }}, attributes [0] Attributes{{ CRIAttributes }} }

Attributes { ATTRIBUTE:IOSet } ::= SET OF Attribute{{ IOSet }}

Attribute { ATTRIBUTE:IOSet } ::= SEQUENCE { type ATTRIBUTE.&id({IOSet}), values SET SIZE(1..MAX) OF ATTRIBUTE.&Type({IOSet}{\@type}) }


Field Summary
private static java.util.Hashtable<java.lang.Object,java.lang.Object> algorithms
           
private static java.util.Hashtable<java.lang.Object,java.lang.Object> keyAlgorithms
           
private static java.util.Set<java.lang.Object> noParams
           
private static java.util.Hashtable<java.lang.Object,java.lang.Object> oids
           
private static java.util.Hashtable<java.lang.Object,java.lang.Object> params
           
 
Fields inherited from class kz.gamma.asn1.pkcs.CertificationRequest
reqInfo, sigAlgId, sigBits
 
Fields inherited from class kz.gamma.asn1.ASN1Encodable
BER, DER
 
Constructor Summary
PKCS10CertificationRequest(ASN1Sequence sequence)
           
PKCS10CertificationRequest(byte[] bytes)
          construct a PKCS10 certification request from a DER encoded byte stream.
PKCS10CertificationRequest(java.lang.String signatureAlgorithm, javax.security.auth.x500.X500Principal subject, java.security.PublicKey key, ASN1Set attributes, java.security.PrivateKey signingKey)
          create a PKCS10 certfication request using the BC provider.
PKCS10CertificationRequest(java.lang.String signatureAlgorithm, javax.security.auth.x500.X500Principal subject, java.security.PublicKey key, ASN1Set attributes, java.security.PrivateKey signingKey, java.lang.String provider)
          create a PKCS10 certfication request using the named provider.
PKCS10CertificationRequest(java.lang.String signatureAlgorithm, X509Name subject, java.security.PublicKey key, ASN1Set attributes, java.security.PrivateKey signingKey)
          create a PKCS10 certfication request using the BC provider.
PKCS10CertificationRequest(java.lang.String signatureAlgorithm, X509Name subject, java.security.PublicKey key, ASN1Set attributes, java.security.PrivateKey signingKey, java.lang.String provider)
          create a PKCS10 certfication request using the named provider.
 
Method Summary
private static X509Name convertName(javax.security.auth.x500.X500Principal name)
           
private static RSASSAPSSparams creatPSSParams(AlgorithmIdentifier hashAlgId, int saltSize)
           
private static java.lang.String getDigestAlgName(DERObjectIdentifier digestAlgOID)
           
 byte[] getEncoded()
          return a DER encoded byte array representing this object
 java.security.PublicKey getPublicKey()
          return the public key associated with the certification request - the public key is created using the BC provider.
 java.security.PublicKey getPublicKey(java.lang.String provider)
           
(package private) static java.lang.String getSignatureName(AlgorithmIdentifier sigAlgId)
           
private  void setSignatureParameters(java.security.Signature signature, DEREncodable params)
           
private static ASN1Sequence toDERSequence(byte[] bytes)
           
 boolean verify()
          verify the request using the BC provider.
 boolean verify(java.security.PublicKey pubKey, java.lang.String provider)
          verify the request using the passed in public key and the provider..
 boolean verify(java.lang.String provider)
          verify the request using the passed in provider.
 
Methods inherited from class kz.gamma.asn1.pkcs.CertificationRequest
getCertificationRequestInfo, getInstance, getSignature, getSignatureAlgorithm, toASN1Object
 
Methods inherited from class kz.gamma.asn1.ASN1Encodable
equals, getDEREncoded, getDERObject, getEncoded, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

algorithms

private static java.util.Hashtable<java.lang.Object,java.lang.Object> algorithms

params

private static java.util.Hashtable<java.lang.Object,java.lang.Object> params

keyAlgorithms

private static java.util.Hashtable<java.lang.Object,java.lang.Object> keyAlgorithms

oids

private static java.util.Hashtable<java.lang.Object,java.lang.Object> oids

noParams

private static java.util.Set<java.lang.Object> noParams
Constructor Detail

PKCS10CertificationRequest

public PKCS10CertificationRequest(byte[] bytes)
construct a PKCS10 certification request from a DER encoded byte stream.

Parameters:
bytes - PKCS#10 запрос в виде массива байт

PKCS10CertificationRequest

public PKCS10CertificationRequest(ASN1Sequence sequence)

PKCS10CertificationRequest

public PKCS10CertificationRequest(java.lang.String signatureAlgorithm,
                                  X509Name subject,
                                  java.security.PublicKey key,
                                  ASN1Set attributes,
                                  java.security.PrivateKey signingKey)
                           throws java.security.NoSuchAlgorithmException,
                                  java.security.NoSuchProviderException,
                                  java.security.InvalidKeyException,
                                  java.security.SignatureException
create a PKCS10 certfication request using the BC provider.

Parameters:
signatureAlgorithm - Алгоритм подписи
subject - DN
key - Открытый ключ
attributes - Атрибуты
signingKey - Закрытый ключ
Throws:
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
java.security.SignatureException

PKCS10CertificationRequest

public PKCS10CertificationRequest(java.lang.String signatureAlgorithm,
                                  javax.security.auth.x500.X500Principal subject,
                                  java.security.PublicKey key,
                                  ASN1Set attributes,
                                  java.security.PrivateKey signingKey)
                           throws java.security.NoSuchAlgorithmException,
                                  java.security.NoSuchProviderException,
                                  java.security.InvalidKeyException,
                                  java.security.SignatureException
create a PKCS10 certfication request using the BC provider.

Parameters:
signatureAlgorithm - Алгоритм подписи
subject - DN
key - Открытый ключ
attributes - Атрибуты
signingKey - Закрытый ключ
Throws:
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
java.security.SignatureException

PKCS10CertificationRequest

public PKCS10CertificationRequest(java.lang.String signatureAlgorithm,
                                  javax.security.auth.x500.X500Principal subject,
                                  java.security.PublicKey key,
                                  ASN1Set attributes,
                                  java.security.PrivateKey signingKey,
                                  java.lang.String provider)
                           throws java.security.NoSuchAlgorithmException,
                                  java.security.NoSuchProviderException,
                                  java.security.InvalidKeyException,
                                  java.security.SignatureException
create a PKCS10 certfication request using the named provider.

Parameters:
signatureAlgorithm - Алгоритм подписи
subject - DN
key - Открытый ключ
attributes - Атрибуты
signingKey - Закрытый ключ
provider - Провайдер
Throws:
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
java.security.SignatureException

PKCS10CertificationRequest

public PKCS10CertificationRequest(java.lang.String signatureAlgorithm,
                                  X509Name subject,
                                  java.security.PublicKey key,
                                  ASN1Set attributes,
                                  java.security.PrivateKey signingKey,
                                  java.lang.String provider)
                           throws java.security.NoSuchAlgorithmException,
                                  java.security.NoSuchProviderException,
                                  java.security.InvalidKeyException,
                                  java.security.SignatureException
create a PKCS10 certfication request using the named provider.

Parameters:
signatureAlgorithm - Алгоритм подписи
subject - DN
key - Открытый ключ
attributes - Атрибуты
signingKey - Закрытый ключ
provider - Провайдер
Throws:
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
java.security.SignatureException
Method Detail

creatPSSParams

private static RSASSAPSSparams creatPSSParams(AlgorithmIdentifier hashAlgId,
                                              int saltSize)

toDERSequence

private static ASN1Sequence toDERSequence(byte[] bytes)

convertName

private static X509Name convertName(javax.security.auth.x500.X500Principal name)

getPublicKey

public java.security.PublicKey getPublicKey()
                                     throws java.security.NoSuchAlgorithmException,
                                            java.security.NoSuchProviderException,
                                            java.security.InvalidKeyException
return the public key associated with the certification request - the public key is created using the BC provider.

Returns:
Открытый ключ
Throws:
java.security.InvalidKeyException
java.security.NoSuchProviderException
java.security.NoSuchAlgorithmException

getPublicKey

public java.security.PublicKey getPublicKey(java.lang.String provider)
                                     throws java.security.NoSuchAlgorithmException,
                                            java.security.NoSuchProviderException,
                                            java.security.InvalidKeyException
Throws:
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
java.security.InvalidKeyException

verify

public boolean verify()
               throws java.security.NoSuchAlgorithmException,
                      java.security.NoSuchProviderException,
                      java.security.InvalidKeyException,
                      java.security.SignatureException
verify the request using the BC provider.

Returns:
true, если запрос верен, иначе false
Throws:
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
java.security.SignatureException

verify

public boolean verify(java.lang.String provider)
               throws java.security.NoSuchAlgorithmException,
                      java.security.NoSuchProviderException,
                      java.security.InvalidKeyException,
                      java.security.SignatureException
verify the request using the passed in provider.

Parameters:
provider - Провайдер
Returns:
true, если запрос верен, иначе false
Throws:
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
java.security.SignatureException

verify

public boolean verify(java.security.PublicKey pubKey,
                      java.lang.String provider)
               throws java.security.NoSuchAlgorithmException,
                      java.security.NoSuchProviderException,
                      java.security.InvalidKeyException,
                      java.security.SignatureException
verify the request using the passed in public key and the provider..

Parameters:
pubKey - Открытый ключ
provider - Провайдер
Returns:
true, если запрос верен, иначе false
Throws:
java.security.InvalidKeyException
java.security.NoSuchAlgorithmException
java.security.NoSuchProviderException
java.security.SignatureException

getEncoded

public byte[] getEncoded()
return a DER encoded byte array representing this object

Overrides:
getEncoded in class ASN1Encodable

setSignatureParameters

private void setSignatureParameters(java.security.Signature signature,
                                    DEREncodable params)
                             throws java.security.NoSuchAlgorithmException,
                                    java.security.SignatureException,
                                    java.security.InvalidKeyException
Throws:
java.security.NoSuchAlgorithmException
java.security.SignatureException
java.security.InvalidKeyException

getSignatureName

static java.lang.String getSignatureName(AlgorithmIdentifier sigAlgId)

getDigestAlgName

private static java.lang.String getDigestAlgName(DERObjectIdentifier digestAlgOID)


Copyright © 1998-2014 Gamma Technologies. All Rights Reserved.