Skip to content

Commit 31b8a96

Browse files
Jonathan PatchellJonathan Patchell
Jonathan Patchell
authored and
Jonathan Patchell
committed
[FAB-4177] BCCSP PKCS11 DER encoding for CKA_EC_POINT
Change request to address [FAB-4177] so that CKA_EC_POINT is always DER encoded when importing EC public keys with the BCCSP PKCS11 implementation. Change-Id: I3309c5c31722f7187f38bd2dbadaa7a5932e2ae2 Signed-off-by: Jonathan Patchell <[email protected]>
1 parent 5cbf914 commit 31b8a96

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

bccsp/pkcs11/pkcs11.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"encoding/hex"
2424
"fmt"
2525
"math/big"
26-
"strings"
2726
"sync"
2827

2928
"github.com/miekg/pkcs11"
@@ -392,10 +391,8 @@ func (csp *impl) importECKey(curve asn1.ObjectIdentifier, privKey, ecPt []byte,
392391
hash := sha256.Sum256(ecPt)
393392
ski = hash[:]
394393

395-
if strings.Contains(csp.lib, "softhsm") {
396-
// Probably SoftHSM, some handcrafting necessary
397-
ecPt = append([]byte{0x04, byte(len(ecPt))}, ecPt...)
398-
}
394+
// Add DER encoding for the CKA_EC_POINT
395+
ecPt = append([]byte{0x04, byte(len(ecPt))}, ecPt...)
399396

400397
keyTemplate = []*pkcs11.Attribute{
401398
pkcs11.NewAttribute(pkcs11.CKA_KEY_TYPE, pkcs11.CKK_EC),

0 commit comments

Comments
 (0)