Chilkat Online Tools

DescribeCertificateAuthority Xojo Example

AWS Private CA

// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

Dim rest As New Chilkat.Rest
Dim success As Boolean

Dim authAws As New Chilkat.AuthAws
authAws.AccessKey = "AWS_ACCESS_KEY"
authAws.SecretKey = "AWS_SECRET_KEY"

// Don't forget to change the region to your particular region. (Also make the same change in the call to Connect below.)
authAws.Region = "us-west-2"
authAws.ServiceName = "acm-pca"
// SetAuthAws causes Chilkat to automatically add the following headers: Authorization, X-Amz-Date
success = rest.SetAuthAws(authAws)

// URL: https://acm-pca.us-west-2.amazonaws.com/
// Use the same region as specified above.
success = rest.Connect("acm-pca.us-west-2.amazonaws.com",443,True,True)
If (success <> True) Then
    System.DebugLog("ConnectFailReason: " + Str(rest.ConnectFailReason))
    System.DebugLog(rest.LastErrorText)
    Return
End If

// The following code creates the JSON request body.
// The JSON created by this code is shown below.

// Use this online tool to generate code from sample JSON:
// Generate Code to Create JSON

Dim json As New Chilkat.JsonObject
success = json.UpdateString("CertificateAuthorityArn","string")

// The JSON request body created by the above code:

// {
//   "CertificateAuthorityArn": "string"
// }

success = rest.AddHeader("Content-Type","application/x-amz-json-1.1")
success = rest.AddHeader("X-Amz-Target","ACMPrivateCA.DescribeCertificateAuthority")

Dim sbRequestBody As New Chilkat.StringBuilder
success = json.EmitSb(sbRequestBody)
Dim sbResponseBody As New Chilkat.StringBuilder
success = rest.FullRequestSb("POST","/",sbRequestBody,sbResponseBody)
If (success <> True) Then
    System.DebugLog(rest.LastErrorText)
    Return
End If

Dim respStatusCode As Int32
respStatusCode = rest.ResponseStatusCode
System.DebugLog("response status code = " + Str(respStatusCode))
If (respStatusCode <> 200) Then
    System.DebugLog("Response Header:")
    System.DebugLog(rest.ResponseHeader)
    System.DebugLog("Response Body:")
    System.DebugLog(sbResponseBody.GetAsString())
    Return
End If

Dim jResp As New Chilkat.JsonObject
success = jResp.LoadSb(sbResponseBody)

// The following code parses the JSON response.
// A sample JSON response is shown below the sample code.

// Use this online tool to generate parsing code from sample JSON:
// Generate Parsing Code from JSON

Dim DirectoryNameCommonName As String
Dim DirectoryNameCountry As String
Dim DirectoryNameDistinguishedNameQualifier As String
Dim DirectoryNameGenerationQualifier As String
Dim DirectoryNameGivenName As String
Dim DirectoryNameInitials As String
Dim DirectoryNameLocality As String
Dim DirectoryNameOrganization As String
Dim DirectoryNameOrganizationalUnit As String
Dim DirectoryNamePseudonym As String
Dim DirectoryNameSerialNumber As String
Dim DirectoryNameState As String
Dim DirectoryNameSurname As String
Dim DirectoryNameTitle As String
Dim DnsName As String
Dim NameAssigner As String
Dim PartyName As String
Dim IpAddress As String
Dim TypeId As String
Dim Value As String
Dim RegisteredId As String
Dim Rfc822Name As String
Dim UniformResourceIdentifier As String
Dim AccessMethodType As String
Dim CustomObjectIdentifier As String

Dim Arn As String
Arn = jResp.StringOf("CertificateAuthority.Arn")
Dim CRLSign As Int32
CRLSign = jResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.CRLSign")
Dim DataEncipherment As Int32
DataEncipherment = jResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.DataEncipherment")
Dim DecipherOnly As Int32
DecipherOnly = jResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.DecipherOnly")
Dim DigitalSignature As Int32
DigitalSignature = jResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.DigitalSignature")
Dim EncipherOnly As Int32
EncipherOnly = jResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.EncipherOnly")
Dim KeyAgreement As Int32
KeyAgreement = jResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.KeyAgreement")
Dim KeyCertSign As Int32
KeyCertSign = jResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.KeyCertSign")
Dim KeyEncipherment As Int32
KeyEncipherment = jResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.KeyEncipherment")
Dim NonRepudiation As Int32
NonRepudiation = jResp.IntOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.KeyUsage.NonRepudiation")
Dim KeyAlgorithm As String
KeyAlgorithm = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.KeyAlgorithm")
Dim SigningAlgorithm As String
SigningAlgorithm = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.SigningAlgorithm")
Dim CommonName As String
CommonName = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.CommonName")
Dim Country As String
Country = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.Country")
Dim DistinguishedNameQualifier As String
DistinguishedNameQualifier = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.DistinguishedNameQualifier")
Dim GenerationQualifier As String
GenerationQualifier = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.GenerationQualifier")
Dim GivenName As String
GivenName = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.GivenName")
Dim Initials As String
Initials = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.Initials")
Dim Locality As String
Locality = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.Locality")
Dim Organization As String
Organization = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.Organization")
Dim OrganizationalUnit As String
OrganizationalUnit = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.OrganizationalUnit")
Dim Pseudonym As String
Pseudonym = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.Pseudonym")
Dim SerialNumber As String
SerialNumber = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.SerialNumber")
Dim State As String
State = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.State")
Dim Surname As String
Surname = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.Surname")
Dim Title As String
Title = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.Subject.Title")
Dim CreatedAt As Int32
CreatedAt = jResp.IntOf("CertificateAuthority.CreatedAt")
Dim FailureReason As String
FailureReason = jResp.StringOf("CertificateAuthority.FailureReason")
Dim KeyStorageSecurityStandard As String
KeyStorageSecurityStandard = jResp.StringOf("CertificateAuthority.KeyStorageSecurityStandard")
Dim LastStateChangeAt As Int32
LastStateChangeAt = jResp.IntOf("CertificateAuthority.LastStateChangeAt")
Dim NotAfter As Int32
NotAfter = jResp.IntOf("CertificateAuthority.NotAfter")
Dim NotBefore As Int32
NotBefore = jResp.IntOf("CertificateAuthority.NotBefore")
Dim OwnerAccount As String
OwnerAccount = jResp.StringOf("CertificateAuthority.OwnerAccount")
Dim RestorableUntil As Int32
RestorableUntil = jResp.IntOf("CertificateAuthority.RestorableUntil")
Dim CustomCname As String
CustomCname = jResp.StringOf("CertificateAuthority.RevocationConfiguration.CrlConfiguration.CustomCname")
Dim Enabled As Int32
Enabled = jResp.IntOf("CertificateAuthority.RevocationConfiguration.CrlConfiguration.Enabled")
Dim ExpirationInDays As Int32
ExpirationInDays = jResp.IntOf("CertificateAuthority.RevocationConfiguration.CrlConfiguration.ExpirationInDays")
Dim S3BucketName As String
S3BucketName = jResp.StringOf("CertificateAuthority.RevocationConfiguration.CrlConfiguration.S3BucketName")
Dim S3ObjectAcl As String
S3ObjectAcl = jResp.StringOf("CertificateAuthority.RevocationConfiguration.CrlConfiguration.S3ObjectAcl")
Dim OcspConfigurationEnabled As Int32
OcspConfigurationEnabled = jResp.IntOf("CertificateAuthority.RevocationConfiguration.OcspConfiguration.Enabled")
Dim OcspCustomCname As String
OcspCustomCname = jResp.StringOf("CertificateAuthority.RevocationConfiguration.OcspConfiguration.OcspCustomCname")
Dim Serial As String
Serial = jResp.StringOf("CertificateAuthority.Serial")
Dim Status As String
Status = jResp.StringOf("CertificateAuthority.Status")
Dim v_Type As String
v_Type = jResp.StringOf("CertificateAuthority.Type")
Dim i As Int32
i = 0
Dim count_i As Int32
count_i = jResp.SizeOfArray("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess")
While i < count_i
    jResp.I = i
    DirectoryNameCommonName = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.CommonName")
    DirectoryNameCountry = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.Country")
    DirectoryNameDistinguishedNameQualifier = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.DistinguishedNameQualifier")
    DirectoryNameGenerationQualifier = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.GenerationQualifier")
    DirectoryNameGivenName = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.GivenName")
    DirectoryNameInitials = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.Initials")
    DirectoryNameLocality = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.Locality")
    DirectoryNameOrganization = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.Organization")
    DirectoryNameOrganizationalUnit = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.OrganizationalUnit")
    DirectoryNamePseudonym = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.Pseudonym")
    DirectoryNameSerialNumber = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.SerialNumber")
    DirectoryNameState = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.State")
    DirectoryNameSurname = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.Surname")
    DirectoryNameTitle = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DirectoryName.Title")
    DnsName = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.DnsName")
    NameAssigner = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.EdiPartyName.NameAssigner")
    PartyName = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.EdiPartyName.PartyName")
    IpAddress = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.IpAddress")
    TypeId = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.OtherName.TypeId")
    Value = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.OtherName.Value")
    RegisteredId = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.RegisteredId")
    Rfc822Name = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.Rfc822Name")
    UniformResourceIdentifier = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessLocation.UniformResourceIdentifier")
    AccessMethodType = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessMethod.AccessMethodType")
    CustomObjectIdentifier = jResp.StringOf("CertificateAuthority.CertificateAuthorityConfiguration.CsrExtensions.SubjectInformationAccess[i].AccessMethod.CustomObjectIdentifier")
    i = i + 1
Wend

// A sample JSON response body parsed by the above code:

// {
//   "CertificateAuthority": {
//     "Arn": "string",
//     "CertificateAuthorityConfiguration": {
//       "CsrExtensions": {
//         "KeyUsage": {
//           "CRLSign": boolean,
//           "DataEncipherment": boolean,
//           "DecipherOnly": boolean,
//           "DigitalSignature": boolean,
//           "EncipherOnly": boolean,
//           "KeyAgreement": boolean,
//           "KeyCertSign": boolean,
//           "KeyEncipherment": boolean,
//           "NonRepudiation": boolean
//         },
//         "SubjectInformationAccess": [
//           {
//             "AccessLocation": {
//               "DirectoryName": {
//                 "CommonName": "string",
//                 "Country": "string",
//                 "DistinguishedNameQualifier": "string",
//                 "GenerationQualifier": "string",
//                 "GivenName": "string",
//                 "Initials": "string",
//                 "Locality": "string",
//                 "Organization": "string",
//                 "OrganizationalUnit": "string",
//                 "Pseudonym": "string",
//                 "SerialNumber": "string",
//                 "State": "string",
//                 "Surname": "string",
//                 "Title": "string"
//               },
//               "DnsName": "string",
//               "EdiPartyName": {
//                 "NameAssigner": "string",
//                 "PartyName": "string"
//               },
//               "IpAddress": "string",
//               "OtherName": {
//                 "TypeId": "string",
//                 "Value": "string"
//               },
//               "RegisteredId": "string",
//               "Rfc822Name": "string",
//               "UniformResourceIdentifier": "string"
//             },
//             "AccessMethod": {
//               "AccessMethodType": "string",
//               "CustomObjectIdentifier": "string"
//             }
//           }
//         ]
//       },
//       "KeyAlgorithm": "string",
//       "SigningAlgorithm": "string",
//       "Subject": {
//         "CommonName": "string",
//         "Country": "string",
//         "DistinguishedNameQualifier": "string",
//         "GenerationQualifier": "string",
//         "GivenName": "string",
//         "Initials": "string",
//         "Locality": "string",
//         "Organization": "string",
//         "OrganizationalUnit": "string",
//         "Pseudonym": "string",
//         "SerialNumber": "string",
//         "State": "string",
//         "Surname": "string",
//         "Title": "string"
//       }
//     },
//     "CreatedAt": number,
//     "FailureReason": "string",
//     "KeyStorageSecurityStandard": "string",
//     "LastStateChangeAt": number,
//     "NotAfter": number,
//     "NotBefore": number,
//     "OwnerAccount": "string",
//     "RestorableUntil": number,
//     "RevocationConfiguration": {
//       "CrlConfiguration": {
//         "CustomCname": "string",
//         "Enabled": boolean,
//         "ExpirationInDays": number,
//         "S3BucketName": "string",
//         "S3ObjectAcl": "string"
//       },
//       "OcspConfiguration": {
//         "Enabled": boolean,
//         "OcspCustomCname": "string"
//       }
//     },
//     "Serial": "string",
//     "Status": "string",
//     "Type": "string"
//   }
// }