public static AsnPublicKeyPair FromRSA(RSAParameters rsa) { AsnPublicKeyPair kp = new AsnPublicKeyPair { modulus = new AsnInteger(rsa.Modulus), exponent = new AsnInteger(rsa.Exponent) }; return(kp); }
public static AsnPublicKeyPair Decode(byte[] source, ref int pos) { AsnPublicKeyPair instance = new AsnPublicKeyPair(); pos++; long len = instance.GetLength(source, ref pos); instance.modulus = AsnInteger.Decode(source, ref pos); instance.exponent = AsnInteger.Decode(source, ref pos); // bring the parameters into an RSA format instance.parameters.Modulus = instance.modulus.myValue.ToByteArray(); instance.parameters.Exponent = instance.exponent.myValue.ToByteArray(); return(instance); }
public static AsnPublicKeyInfo Decode(byte[] source, ref int pos) { AsnPublicKeyInfo instance = new AsnPublicKeyInfo(); //CheckContextTag(source, ref pos); pos++; int len = instance.GetLength(source, ref pos); instance.algorithm = AsnAlgorithmIdentifier.Decode(source, ref pos); instance.publicKey = AsnBitstring.Decode(source, ref pos); // TODO: further decode publicKey into AsnKeyPair int bi = 0; instance.keys = AsnPublicKeyPair.Decode(instance.publicKey.value, ref bi); return(instance); }
public AsnPublicKeyInfo() { algorithm = new AsnAlgorithmIdentifier(); publicKey = new AsnBitstring(); keys = new AsnPublicKeyPair(); }
public AsnPublicKeyPair GetPublicKey() { AsnPublicKeyPair publicKey = AsnPublicKeyPair.FromRSA(parameters); return(publicKey); }