|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--X509CertificateGenerator
Class implementing a X.509 certificate generator
Defined in x509certificategenerator.js
Field Summary | |
Object |
crypto
|
Object |
encodeECDomainParameter
|
<static> Object |
cRLSign
|
<static> Object |
dataEncipherment
|
<static> Object |
decipherOnly
|
<static> Object |
digitalSignature
|
<static> Object |
encipherOnly
|
<static> Object |
keyAgreement
|
<static> Object |
keyCertSign
|
<static> Object |
keyEncipherment
|
<static> Object |
nonRepudiation
|
Constructor Summary | |
X509CertificateGenerator(<Crypto> crypto)
Create a X.509 certificate generator. |
Method Summary | |
void
|
addAuthorityKeyIdentifierExtension(<Key> publicKey)
Adds the authority public key identifier extension based on the issuers key. |
void
|
addBasicConstraintsExtension(<Boolean> cA, <Number> pathLenConstraint)
Adds the BasicConstraints extension. |
void
|
addCRLDistributionPointURL(<String[]> url)
Adds the CRL distribution point URLs. |
void
|
addExtendedKeyUsages(<String[]> oids, <Boolean> critical)
Adds the extended key usage extension |
void
|
addExtension(<String> extnID, <Boolean> critical, extnValue)
Adds an extension to the certificate |
void
|
addKeyUsageExtension(flags)
Adds the key usage extension. |
void
|
addSubjectKeyIdentifierExtension()
Adds the subject public key identifier extension based on the certificates subject key. |
X509
|
generateX509Certificate(privateKey)
Generates the certificate. |
ASN1
|
getExtensions()
Gets the certificate extension as TLV object |
ASN1
|
getIssuer()
Gets the issuer name as TLV object |
ASN1
|
getSignatureAlgorithm()
Gets the signature algorithm TLV object |
ASN1
|
getSubject()
Gets the subject name as TLV object |
ASN1
|
getSubjectPublicKeyInfo()
Gets the subject's public key as TLV object |
ASN1
|
getTbsCertificate()
Gets the part of the certificate that will be signed |
ASN1
|
getValidity()
Gets the certificate validity as TLV object |
void
|
reset()
Resets all internal state variables. |
void
|
setIssuer(<Object> issuer)
Sets the isser name. |
void
|
setNotAfter(date)
Sets the expiration date for the certificate. |
void
|
setNotBefore(date)
Sets the effective date for the certificate. |
void
|
setPublicKey(<Key> publicKey)
Sets the subjects public key |
void
|
setSerialNumber(<ByteString> serialNumber)
Sets the serial number. |
void
|
setSignatureAlgorithm(<Number> alg)
Sets the signature algorithm. |
void
|
setSubject(<Object> subject)
Sets the subject name. |
Field Detail |
Object crypto
Object encodeECDomainParameter
<static> Object cRLSign
<static> Object dataEncipherment
<static> Object decipherOnly
<static> Object digitalSignature
<static> Object encipherOnly
<static> Object keyAgreement
<static> Object keyCertSign
<static> Object keyEncipherment
<static> Object nonRepudiation
Constructor Detail |
X509CertificateGenerator(<Crypto> crypto)
crypto
- the crypto provider to use for signing operations
Method Detail |
void addAuthorityKeyIdentifierExtension(<Key> publicKey)
The key identifier is calculated as SHA-1 hash over the contents of the issuer public key (Without tag, length and number of unused bits.
publicKey
- the authority subject key
void addBasicConstraintsExtension(<Boolean> cA, <Number> pathLenConstraint)
cA
- the certificate belongs to a CA
pathLenConstraint
- the maximum number of subordinate CA certificates
void addCRLDistributionPointURL(<String[]> url)
url
- a list of URLs
void addExtendedKeyUsages(<String[]> oids, <Boolean> critical)
oids
- the list of object identifier names
critical
- the extension is critical
void addExtension(<String> extnID, <Boolean> critical, extnValue)
The structure is defined as:
Extension ::= SEQUENCE { extnID OBJECT IDENTIFIER, critical BOOLEAN DEFAULT FALSE, extnValue OCTET STRING -- contains the DER encoding of an ASN.1 value -- corresponding to the extension type identified -- by extnID }
extnID
- the extensions object identifier
critical
- the extension is critical
the
- extension value as ByteString
void addKeyUsageExtension(flags)
The following flags are defined:
PKIXCommon.digitalSignature = 0x0080; PKIXCommon.nonRepudiation = 0x0040; PKIXCommon.keyEncipherment = 0x0020; PKIXCommon.dataEncipherment = 0x0010; PKIXCommon.keyAgreement = 0x0008; PKIXCommon.keyCertSign = 0x0004; PKIXCommon.cRLSign = 0x0002; PKIXCommon.encipherOnly = 0x0001; PKIXCommon.decipherOnly = 0x8000;
the
- key usage flags as combination of the flags defined above.
void addSubjectKeyIdentifierExtension()
The key identifier is calculated as SHA-1 hash over the contents of the subject public key (Without tag, length and number of unused bits.
X509 generateX509Certificate(privateKey)
ASN1 getExtensions()
ASN1 getIssuer()
ASN1 getSignatureAlgorithm()
ASN1 getSubject()
ASN1 getSubjectPublicKeyInfo()
ASN1 getTbsCertificate()
ASN1 getValidity()
void reset()
void setIssuer(<Object> issuer)
The issuer name must be a JavaScript object containing the properties:
Example:
var issuer = { C:"UT", O:"ACME Corporation", CN:"Test-CA" };
issuer
- the issuer name
void setNotAfter(date)
String
- or Date} date the date in format YYMMDDHHMMSSZ
void setNotBefore(date)
String
- or Date} date the date in format YYMMDDHHMMSSZ
void setPublicKey(<Key> publicKey)
The methods accepts ECC and RSA Public Keys.
publicKey
- the subjects public key
void setSerialNumber(<ByteString> serialNumber)
serialNumber
- the serial number for the certificate
void setSignatureAlgorithm(<Number> alg)
alg
- the signature algorithm, only Crypto.RSA supported
void setSubject(<Object> subject)
The subject name must be a JavaScript object containing the properties:
Example:
var subject = { C:"UT", O:"ACME Corporation", CN:"Joe Doe" };
subject
- the subject name
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |