I created a CRL in Go (parsed it into PEM) and now I want to re-create the exact same CRL in Java (to obtain the same PEM). However, I'm not sure how to do this, I find that the CRL classes in Go and Java are very different.
I created the CRL in Golang the following way:
var revokedCerts []pkix.RevokedCertificate
clientRevocation := pkix.RevokedCertificate{
SerialNumber: clientCert.SerialNumber,
RevocationTime: timeToUseInRevocation.UTC(),
}
revokedCerts = append(revokedCerts, clientRevocation)
crlSubject := pkix.Name{
Organization: []string{"testorg", "TestOrg"},
StreetAddress: []string{"TestAddress"},
PostalCode: []string{"0"},
Province: []string{"TestProvince"},
Locality: []string{"TestLocality"},
Country: []string{"TestCountry"},
CommonName: "Test Name",
}
var sigAlgorithm pkix.AlgorithmIdentifier
sigAlgorithm.Algorithm = asn1.ObjectIdentifier{1, 2, 840, 113549, 1, 1, 11}
sigAlgorithm.Parameters = asn1.NullRawValue
tbsCertList := pkix.TBSCertificateList{
Version: 1,
Signature: sigAlgorithm,
Issuer: crlSubject.ToRDNSequence(),
ThisUpdate: timeToUseInRevocation,
NextUpdate: timeToUseInRevocation.Add(time.Millisecond * time.Duration(86400000)),
RevokedCertificates: revokedCerts,
}
newCRL, err := asn1.Marshal(pkix.CertificateList{
TBSCertList: tbsCertList, // new CRL
SignatureAlgorithm: sigAlgorithm,
SignatureValue: asn1.BitString{},
})
crlCreated, err := x509.ParseCRL(newCRL)
//CRL pem Block
crlPemBlock := &pem.Block{
Type: "X509 CRL",
Bytes: newCRL,
}
var crlBuffer bytes.Buffer
err = pem.Encode(&crlBuffer, crlPemBlock)
I want to reproduce this in Java. I am aware that I have variables (e.g. crl signature) that are empty/nil. That is for the purpose of what I want to do. I could take the PEM and read to a CRL in Java but I'm not being able to do so to create the exact same CRL.
I want to create the CRL in Java also without a signature (all parameters equal).