diff options
author | David Hook <dgh@bouncycastle.org> | 2019-01-15 09:36:13 +1100 |
---|---|---|
committer | David Hook <dgh@bouncycastle.org> | 2019-01-15 09:36:13 +1100 |
commit | e1cd803b9802dfc2d4f35a4b29aab2d728f70b20 (patch) | |
tree | 1449dbde32b2f37ecea843b1549aead48f1f2618 /crypto/src/asn1 | |
parent | updated (diff) | |
download | BouncyCastle.NET-ed25519-e1cd803b9802dfc2d4f35a4b29aab2d728f70b20.tar.xz |
update
Diffstat (limited to 'crypto/src/asn1')
-rw-r--r-- | crypto/src/asn1/crmf/EncryptedValueBuilder.cs | 53 | ||||
-rw-r--r-- | crypto/src/asn1/crmf/ProofOfPossessionSigningKeyBuilder.cs | 90 |
2 files changed, 0 insertions, 143 deletions
diff --git a/crypto/src/asn1/crmf/EncryptedValueBuilder.cs b/crypto/src/asn1/crmf/EncryptedValueBuilder.cs deleted file mode 100644 index 4b57156d4..000000000 --- a/crypto/src/asn1/crmf/EncryptedValueBuilder.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using Org.BouncyCastle.Asn1.Nist; -using Org.BouncyCastle.Crypto; -using Org.BouncyCastle.Crypto.Engines; -using Org.BouncyCastle.Crypto.Parameters; -using Org.BouncyCastle.Utilities; - -namespace Org.BouncyCastle.Asn1.Crmf -{ - -// public delegate IBlockCipher BlockCipherCreator(ICipherParameters); -// -// public class EncryptedValueBuilder -// { -// private readonly IBlockCipher _cipher; -// private static readonly IDictionary algToDelegate = Platform.CreateHashtable(); -// static EncryptedValueBuilder() -// { -// algToDelegate[NistObjectIdentifiers.IdAes128Cbc] = new CipherCreator() -// {Creator = delegate(ICipherParameters param) { return new AesEngine(); }}; -// -// } -// -// -// public EncryptedValueBuilder(DerObjectIdentifier alg) -// { -// -// } -// -// -// private static IBlockCipher AesCBC(ICipherParameters param) -// { -// if (param is ParametersWithIV ivParam) { -// return new -// } -// else -// { -// throw new ArgumentException("expecting param to be ParametersWithIv"); -// } -// } -// -// -// -// private class CipherCreator -// { -// public BlockCipherCreator Creator { get; set; } -// } -// -// } -} diff --git a/crypto/src/asn1/crmf/ProofOfPossessionSigningKeyBuilder.cs b/crypto/src/asn1/crmf/ProofOfPossessionSigningKeyBuilder.cs deleted file mode 100644 index cbaf834a1..000000000 --- a/crypto/src/asn1/crmf/ProofOfPossessionSigningKeyBuilder.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Org.BouncyCastle.Asn1.X509; -using Org.BouncyCastle.Crypto; -using Org.BouncyCastle.Crypto.Operators; -using Org.BouncyCastle.Crypto.Paddings; - -namespace Org.BouncyCastle.Asn1.Crmf -{ - public class ProofOfPossessionSigningKeyBuilder - { - private CertRequest _certRequest; - private SubjectPublicKeyInfo _pubKeyInfo; - private GeneralName _name; - private PKMacValue _publicKeyMAC; - - public ProofOfPossessionSigningKeyBuilder(CertRequest certRequest) - { - this._certRequest = certRequest; - } - - - public ProofOfPossessionSigningKeyBuilder(SubjectPublicKeyInfo pubKeyInfo) - { - this._pubKeyInfo = pubKeyInfo; - } - - public ProofOfPossessionSigningKeyBuilder setSender(GeneralName name) - { - this._name = name; - - return this; - } - - public ProofOfPossessionSigningKeyBuilder setPublicKeyMac(PkMacFactory generator, char[] password) - { - IStreamCalculator calc = generator.CreateCalculator(); - byte[] d = _pubKeyInfo.GetDerEncoded(); - calc.Stream.Write(d, 0, d.Length); - calc.Stream.Flush(); - calc.Stream.Close(); - - - this._publicKeyMAC = new PKMacValue( - (AlgorithmIdentifier)generator.AlgorithmDetails, - new DerBitString(((DefaultMacAndDigestResult)calc.GetResult()).MacResult)); - - return this; - } - - public PopoSigningKey build(ISignatureFactory signer) - { - if (_name != null && _publicKeyMAC != null) - { - throw new InvalidOperationException("name and publicKeyMAC cannot both be set."); - } - - PopoSigningKeyInput popo; - byte[] b; - IStreamCalculator calc = signer.CreateCalculator(); - if (_certRequest != null) - { - popo = null; - b = _certRequest.GetDerEncoded(); - calc.Stream.Write(b, 0, b.Length); - - } - else if (_name != null) - { - popo = new PopoSigningKeyInput(_name, _pubKeyInfo); - b = popo.GetDerEncoded(); - calc.Stream.Write(b, 0, b.Length); - } - else - { - popo = new PopoSigningKeyInput(_publicKeyMAC, _pubKeyInfo); - b = popo.GetDerEncoded(); - calc.Stream.Write(b, 0, b.Length); - } - - calc.Stream.Flush(); - calc.Stream.Close(); - DefaultSignatureResult res = (DefaultSignatureResult)calc.GetResult(); - return new PopoSigningKey(popo, (AlgorithmIdentifier)signer.AlgorithmDetails, new DerBitString(res.Collect())); - } - - - } -} |