diff options
Diffstat (limited to 'crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs')
-rw-r--r-- | crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs b/crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs index 479aa50cb..97fbd115b 100644 --- a/crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs +++ b/crypto/src/cms/KeyAgreeRecipientInfoGenerator.cs @@ -146,12 +146,10 @@ namespace Org.BouncyCastle.Cms new DerSequence(recipientEncryptedKeys))); } - private static OriginatorPublicKey CreateOriginatorPublicKey(AsymmetricKeyParameter publicKey) - { - SubjectPublicKeyInfo spki = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(publicKey); - return new OriginatorPublicKey( - new AlgorithmIdentifier(spki.AlgorithmID.Algorithm, DerNull.Instance), - spki.PublicKeyData.GetBytes()); - } - } + private static OriginatorPublicKey CreateOriginatorPublicKey(AsymmetricKeyParameter publicKey) => + CreateOriginatorPublicKey(SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(publicKey)); + + private static OriginatorPublicKey CreateOriginatorPublicKey(SubjectPublicKeyInfo originatorKeyInfo) => + new OriginatorPublicKey(originatorKeyInfo.AlgorithmID, originatorKeyInfo.PublicKeyData); + } } |