private static SafeSecKeyRefHandle ImportKey(RSAParameters parameters) { bool isPrivateKey = parameters.D != null; byte[] pkcs1Blob = isPrivateKey ? parameters.ToPkcs1Blob() : parameters.ToSubjectPublicKeyInfo(); return(Interop.AppleCrypto.ImportEphemeralKey(pkcs1Blob, isPrivateKey)); }
internal static byte[] ToSubjectPublicKeyInfo(this RSAParameters parameters) { Debug.Assert(parameters.D == null); // SubjectPublicKeyInfo::= SEQUENCE { // algorithm AlgorithmIdentifier, // subjectPublicKey BIT STRING } return(DerEncoder.ConstructSequence( s_encodedRsaAlgorithmIdentifier, DerEncoder.SegmentedEncodeBitString( parameters.ToPkcs1Blob()))); }