File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -674,20 +674,23 @@ async function unwrapKey({
674
674
const url = `${ keySplitInfo . url } /v2/rewrap` ;
675
675
let ephemeralEncryptionKeysRaw : AnyKeyPair ;
676
676
let ephemeralEncryptionKeys : PemKeyPair ;
677
+ let algorithm : string ;
677
678
if ( wrappingKeyAlgorithm === 'ec:secp256r1' ) {
678
679
ephemeralEncryptionKeysRaw = await generateKeyPair ( ) ;
679
680
ephemeralEncryptionKeys = await cryptoService . cryptoToPemPair ( ephemeralEncryptionKeysRaw ) ;
681
+ algorithm = 'ES256' ;
680
682
} else if ( wrappingKeyAlgorithm === 'rsa:2048' || ! wrappingKeyAlgorithm ) {
681
683
ephemeralEncryptionKeysRaw = await cryptoService . generateKeyPair ( ) ;
682
684
ephemeralEncryptionKeys = await cryptoService . cryptoToPemPair ( ephemeralEncryptionKeysRaw ) ;
685
+ algorithm = 'RS256' ;
683
686
} else {
684
687
throw new ConfigurationError ( `Unsupported wrapping key algorithm [${ wrappingKeyAlgorithm } ]` ) ;
685
688
}
686
689
687
690
const clientPublicKey = ephemeralEncryptionKeys . publicKey ;
688
691
689
692
const requestBodyStr = JSON . stringify ( {
690
- algorithm : 'RS256' ,
693
+ algorithm,
691
694
keyAccess : keySplitInfo ,
692
695
policy : manifest . encryptionInformation . policy ,
693
696
clientPublicKey,
You can’t perform that action at this time.
0 commit comments