mirror of
https://github.com/gregtwallace/apc-p15-tool.git
synced 2025-07-13 02:33:24 +00:00
key: finish key encoding and start cert
This commit is contained in:
parent
85462c93b1
commit
1f6dad4907
14 changed files with 592 additions and 115 deletions
pkg/pkcs15
24
pkg/pkcs15/private_key.go
Normal file
24
pkg/pkcs15/private_key.go
Normal file
|
@ -0,0 +1,24 @@
|
|||
package pkcs15
|
||||
|
||||
import "apc-p15-tool/pkg/tools/asn1obj"
|
||||
|
||||
// privateKeyObject returns the ASN.1 representation of a private key
|
||||
func (p15 *pkcs15KeyCert) privateKeyObject() []byte {
|
||||
// ensure all expected vals are available
|
||||
p15.key.Precompute()
|
||||
|
||||
pkey := asn1obj.Sequence([][]byte{
|
||||
// P
|
||||
asn1obj.IntegerExplicitValue(3, p15.key.Primes[0]),
|
||||
// Q
|
||||
asn1obj.IntegerExplicitValue(4, p15.key.Primes[1]),
|
||||
// Dp
|
||||
asn1obj.IntegerExplicitValue(5, p15.key.Precomputed.Dp),
|
||||
// Dq
|
||||
asn1obj.IntegerExplicitValue(6, p15.key.Precomputed.Dq),
|
||||
// Qinv
|
||||
asn1obj.IntegerExplicitValue(7, p15.key.Precomputed.Qinv),
|
||||
})
|
||||
|
||||
return pkey
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue