CreateDerivedCA create a new CA derived from the certificate in the keypair
(commonName string, organizationalUnit string)
| 356 | // CreateDerivedCA create a new CA derived from the certificate in the |
| 357 | // keypair |
| 358 | func (pair *KeyPair) CreateDerivedCA(commonName string, organizationalUnit string) (*KeyPair, error) { |
| 359 | certificate, err := pair.ParseCertificate() |
| 360 | if err != nil { |
| 361 | return nil, err |
| 362 | } |
| 363 | |
| 364 | key, err := pair.ParseECPrivateKey() |
| 365 | if err != nil { |
| 366 | return nil, err |
| 367 | } |
| 368 | |
| 369 | certificateDuration := getCertificateDuration() |
| 370 | notBefore := time.Now().Add(time.Minute * -5) |
| 371 | notAfter := notBefore.Add(certificateDuration) |
| 372 | |
| 373 | return createCAWithValidity(notBefore, notAfter, certificate, key, commonName, organizationalUnit) |
| 374 | } |
| 375 | |
| 376 | // CreateRootCA generates a CA returning its keys |
| 377 | func CreateRootCA(commonName string, organizationalUnit string) (*KeyPair, error) { |
no test coverage detected