X509
Module Implementation: OpenSSLCryptoInterfaceX509
This module implements X509 certificate support.
Note: Internal classes are italicized and will only contain a short description.
X509
OSSslX509
Implementation of an X509 Certificate.
Class methods: Creation
createNew
Create a new concrete X509 instance.
Answers:
<OSSslX509 subclass> concreate instance
<OpenSSLError compatible error> - error object
createNewFromBytes: aStringOrByteArray
Read the X509 from a DER or PEM encoded data.
Arguments:
aStringOrByteArray - data in <String> or <ByteArray> form
Answers:
< OSSslX509subclass> - X509 instance
<OpenSSLError compatible error> - error object
createNewFromBytes: aStringOrByteArray password: aPassword
Read the X509 from a DER or PEM encoded data. If the data is password protected, then aPassword will be a String. If not password is required, then aPassword will be nil.
Arguments:
aStringOrByteArray - data in <String> or <ByteArray> form
aPassword - Optional password <String>. Could be nil for no passwd.
Answers:
<OSSslX509 subclass> - X509 instance
<OpenSSLError compatible error> - error object
createNewFromFile: aFilename
Read X509 from a DER or PEM encoded file with full path name aFilename.
Arguments:
aFilename - full path name to file
Answers:
<OSSslX509> X509 instance
<OpenSSLError compatible error> - error object
createNewFromFile: aFilename password: aPassword
Read X509 from a DER or PEM encoded file with full path name aFilename. If the data is password protected, then aPassword will be a String. If not password is required, then aPassword will be nil.
Arguments:
aFilename - full path name to file
aPassword - Optional password <String>. Could be nil for no passwd.
Answers:
<OSSslX509> - X509 instance
<OpenSSLError compatible error> - error object
Instance methods: Accessing
issuer
Answer the issuer name from the X509 Certificate
Answers:
<OSSslX509Name> - issuer name
issuer: anX509NameOrString
Answers the maximum size of a signature in bytes.
Arguments:
anX509NameOrString - <OSSslX509Name | String>
Answers:
<Object> - normal return value
<OpenSSLError compatible error> - Ssl error object
notAfter
Not valid after time.
Answers:
<OSSslAsn1Time> - ASN1_TIME from internal X509 struct
notAfter: aAsn1TimeOrDateAndTime
Set the notAfter datetime for the X509 Certificate.
Arguments:
aAsn1TimeOrDateAndTime - <OSSslAsn1Time | DateAndTime>
Answers:
<Object> - normal return value
<OpenSSLError compatible error> - Ssl error object
notBefore
Not valid before time.
Answers:
<OSSslAsn1Time> - ASN1_TIME from internal X509 struct
notBefore: aAsn1TimeOrDateAndTime
Set the notBefore datetime for the X509 Certificate.
Arguments:
aAsn1TimeOrDateAndTime - <OSSslAsn1Time | DateAndTime>
Answers:
<Object> - normal return value
<OpenSSLError compatible error> - Ssl error object
publicKey
Answer a new instance of the the public key <OSSslPKey subclass>.
Answers:
<OSSslPKey subclass> - public key
publicKey: anOSSslPKey
Sets the public key using @anOSSslPKey
Arguments:
anOSSslPKey - <OSSslPKey>
Answers:
<Integer> ignored success value
<OpenSSLError compatible error> - Ssl error object
serialNumber
Get the ASN1_INTEGER serial number.
Answers:
<OSSslAsn1Integer> - Serial Number as a ASN1 Integer
<OpenSSLError compatible error> - Ssl error object
serialNumber: anAsn1IntegerOrInteger
Set the serial number given anAsn1IntegerOrInteger
Arguments:
anAsn1IntegerOrInteger - < OSSslAsn1Integer | Integer >
Answers:
<Object> - normal return value
<OpenSSLError compatible error> - Ssl error object
subject
Answer the subject name from the X509 Certificate.
Answers:
<OSSslX509Name> - subject name
<OpenSSLError> - error object
subject: anX509NameOrString
Set the subject given anX509NameOrString.
Arguments:
anX509NameOrString - <OSSslX509Name | String>
Answers:
<Object> - normal return value
<OpenSSLError compatible error> - Ssl error object
version
Answer the version number from the X509 Certificate.
Answers:
<OSSslAsn1Integer> - version number
<OpenSSLError> - error object
version: anAsn1IntegerOrInteger
Set the version number given anAsn1IntegerOrInteger.
Arguments:
anAsn1IntegerOrInteger - < OSSslAsn1Integer | Integer >
Answers:
OSSslAsn1Integer> - version number
<OpenSSLError> - error object
Instance methods: API
checkPrivateKey: anOSSslPKey
Checks to see if the private key anOSSslPKey is the one corresponding to this certificate.
Arguments:
anOSSslPKey - <OSSslPKey>
Answers:
<Boolean> - true if private key check passed, false otherwise
<OpenSSLError> - error object
digestWith: anOSSslDigest
Answer the message digest of the X509 certificate using the message digest algorithm.
Arguments:
anOSSslDigest - Message digest <OSSslDigest> used to hash the data
Answers:
<ByteArray> - computed message digest
<OpenSSLError> - error object
signWith: anOSSslPKey with: anOSSslDigest
Apply a digital signature to the X509 certificate with the key and message digest algorithm.
Arguments:
anOSSslPKey - Private key <OSSslPKey> used to sign the digest
anOSSslDigest - Message digest <OSSslDigest> used to hash the data
Answers:
<Integer> - signature length
<OpenSSLError> - error object
verifyWith: anOSSslPKey
Verify using the key anOSSslPKey.
Arguments:
anOSSslPKey - <OSSslPKey>
Answers:
<Boolean> - true if verified, false otherwise
<OpenSSLError> - error object
Instance methods: Conversion
asDER
Answer this X509 encoded in DER format as a <ByteArray>.
Answers:
<ByteArray>
asPEM
Answer this X509 encoded in PEM format as a <String>.
Answers:
< String>
Instance methods: Duplication
duplicate
Answers a managed duplicate of this X509 Cert.
Answers:
< OSSslX509> - new duplicate instance
Instance methods: Printing
printDEROn: aStreamOrBIO
Write the X509 in DER format to aStreamOrBIO. This allows Smalltalk stream to be used as well.
Arguments:
aStreamOrBIO - <WriteStream or compatible | OSSslBIO>
Answers:
<WriteStream or compatible | OSSslBIO>
printPEMOn: aStreamOrBIO
Write the X509 in PEM format to aStreamOrBIO. This allows Smalltalk stream to be used as well.
Arguments:
aStreamOrBIO - <WriteStream or compatible | OSSslBIO>
Answers:
<WriteStream or compatible | OSSslBIO>
OSSslX509Name
Object representation of a public key entity such as a name, organization or email address.
Class methods: Creation
createNew
Create a new X509 Name instance.
Answers:
<OSSslX509Name> - new instance
createNewFromString: aString
Create a new X509 Name instance from the provided aString. If aString is not a String, then an error object is returned. If aString is empty, then an empty X509 cert is returned.
Arguments:
<String> - aString
Answers:
<OSSslX509Name> - new instance
<OpenSSLError compatible error> - error object
Instance methods: Accessing
common
Answer the Common name entry for 'CN'.
Answers:
<String>
common: aValueString
Set the Common name entry for 'CN'.
Arguments:
aValueString - <String>
country
Answer the Country name entry for 'C'.
Answers:
<String>
country: aValueString
Set the Country name entry for 'C'.
Arguments:
aValueString - <String>
description
Answer the name entry for 'description'.
Answers:
<String>
description: aValueString
Sets name entry for 'description'.
Arguments:
aValueString - <String>
dnQualifier
Answer the Distinguished Name Qualifier entry for 'dnQualifier'.
Answers:
<String>
dnQualifier: aValueString
Set the Distinguished Name Qualifier name entry for 'dnQualifier'.
Arguments:
aValueString - <String>
generationQualifier
Answer the generationQualifier name entry.
Answers:
<String>
generationQualifier: aValueString
Set the generationQualifier entry for 'GN'.
Arguments:
aValueString - <String>
given
Answer the Given name entry for 'GN'.
Answers:
<String>
given: aValueString
Set the Given name entry for 'GN'
Arguments:
aValueString - <String>
initials
Answer the Surname name entry for 'initials'.
Answers:
<String>
initials: aValueString
Set the Initials name entry for 'initials'.
Arguments:
aValueString - <String>
locality
Answer the Locality name entry for 'L'.
Answers:
<String>
locality: aValueString
Set the Locality name entry for 'L'.
Arguments:
aValueString - <String>
organization
Answer the Organization name entry for 'O'.
Answers:
<String>
organization: aValueString
Set the Organization name entry for 'O'.
Arguments:
aValueString - <String>
organizationUnit
Answer the Organization name entry for 'OU'.
Answers:
<String>
organizationUnit: aValueString
Set the Organization Unit name entry for 'OU'
Arguments:
aValueString - <String>
pseudonym
Answer the Pseudonym name entry.
Answers:
<String>
pseudonym: aValueString
Set the Pseudonym name entry for 'pseudonym'.
Arguments:
aValueString - <String>
serialNumber
Answer the Serial Number name entry.
Answers:
<String>
serialNumber: aValueString
Set the Serial Number name entry.
Arguments:
aValueString - <String>
stateOrProvince
Answer the State Or Province name entry for 'ST'.
Answers:
<String>
stateOrProvince: aValueString
Set the Locality name entry for 'ST'.
Arguments:
aValueString - <String>
surname
Answer the Surname name entry for 'SN'.
Answers:
<String>
surname: aValueString
Set the Surname name entry for 'SN'.
Arguments:
aValueString - <String>
title
Answer the Serial Number name entry for 'title'.
Answers:
<String>
title: aValueString
Set the Title name entry for 'title'.
Arguments:
aValueString - <String>
uid
Answer the Unique Identifier name entry for 'UID'.
Answers:
<String>
uid: aValueString
Set the Unique Identifier name entry for 'UID'.
Arguments:
aValueString - <String>
x509
Answer the X509 name entry for 'X509'.
Answers:
<String>
x509: aValueString
Set the X509 name entry for 'X509'.
Arguments:
aValueString - <String>
Instance methods: API
addEntry: anIntegerOrString with: aValueString
Add a registered entry to the x509Name. If anIntegerOrString is an <Integer>, then this is assumed to be the nid of the registered entry. If anIntegerOrString is a <String>, then this is assumed to be the textual name of the registered entry.
Arguments:
anIntegerOrString - <Integer | String>
aValueString - <String> this is internally enforced
Answers:
<Integer> - success value
<OpenSSLError> - error object
getEntry: anIntegerOrString
Get the registered entry in the x509Name by nid <Integer> or textual name <String>. If anIntegerOrString is an <Integer>, then this is assumed to be the nid of the registered entry. If anIntegerOrString is a <String>, then this is assumed to be the textual name of the registered entry.
Arguments:
anIntegerOrString - <Integer | String>
Answers:
<String> - value
<OpenSSLError> - error object
getEntryCount
Answer the number of entries in this X509 Name.
Answers:
<Integer> - number of entries
<OpenSSLError> - error object
includesEntry: anIntegerOrString
Answer true if anIntegerOrString entry is present.
Arguments:
anIntegerOrString - <Integer> nid OR <String> name that can be mapped to nid
Answers:
<Boolean> - true if included, false otherwise
<OpenSSLError> - error object
indexOfEntry: anIntegerOrString
Answers the index (0-Based) matching the nid associated with anIntegerOrString. If there are no more entires, -1 is returned. If the nid associated with anIntegerOrString is invalid, then an error object is returned.
Arguments:
anIntegerOrString - <Integer> nid OR <String> name that can be mapped to nid
Answers:
<Integer> 0....n is the index
<Integer> -1 if not found
<OpenSSLError> -2 was returned so we wrap with an error object and return
indexOfEntry: anIntegerOrString lastPosition: lastPos
Answers the NEXT index (0-Based) matching the nid associated with anIntegerOrString after lastPos.
lastPos should initially be set to -1. If there are no more entires, -1 is returned. If the nid associated with anIntegerOrString is invalid, then an error object is returned.
Arguments:
anIntegerOrString - <Integer> nid OR <String> name that can be mapped to nid
lastPos - <Integer> lastPosition...so start one index after this
Answers:
<Integer> 0....n is the index
<Integer> -1 if not found
<OpenSSLError> -2 was returned so we wrap with an error object and return
oneLine
Answer a <String> which is the name formatted to one line.
Answers:
<String> - oneline string
<OpenSSLError> - error object
Instance methods: Conversion
asOpenSSLX509Name
Answer myself as a new object reference.
Answers:
<OSSslX509Name> - self
Instance methods: Duplication
duplicate
Answers a managed duplicate of this X509 Name.
Answers:
<OSSslX509Name> - new duplicate instance
<OpenSSLError compatible error> - error object if duplication routine fails
Instance methods: Parsing
parseString: aString
Add the entries from the formatted string aString into this name object.
Example: aString = '/C=JP/O=example/CN=www.example.jp'
Arguments:
aString - <String>
Answers:
<OSSslX509Name> - self
<OpenSSLError> - error object
Extensions
String
asOpenSSLX509Name
Answer a new instance of an X509 Name.
Answers:
<OSSslX509Name>