blob: 91446344ac28641608b4b8be7427a2a645984d1c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
// **********************************************************************
//
// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
#include <IceUtil/Config.h>
#include <IceUtil/Base64.h>
#include <IceSSL/RSAKeyPair.h>
#include <IceSSL/RSAPrivateKey.h>
#include <IceSSL/RSAPublicKey.h>
#include <assert.h>
void IceInternal::incRef(::IceSSL::RSAKeyPair* p) { p->__incRef(); }
void IceInternal::decRef(::IceSSL::RSAKeyPair* p) { p->__decRef(); }
using std::back_inserter;
using std::string;
using Ice::ByteSeq;
using IceUtil::Base64;
IceSSL::RSAKeyPair::RSAKeyPair(const string& key, const string& cert) :
_privateKey(new RSAPrivateKey(key)),
_publicKey(new RSAPublicKey(cert))
{
assert(_privateKey != 0);
assert(_publicKey != 0);
}
IceSSL::RSAKeyPair::RSAKeyPair(const ByteSeq& keySeq, const ByteSeq& certSeq) :
_privateKey(new RSAPrivateKey(keySeq)),
_publicKey(new RSAPublicKey(certSeq))
{
assert(_privateKey != 0);
assert(_publicKey != 0);
}
IceSSL::RSAKeyPair::~RSAKeyPair()
{
}
void
IceSSL::RSAKeyPair::keyToBase64(string& b64Key)
{
_privateKey->keyToBase64(b64Key);
}
void
IceSSL::RSAKeyPair::certToBase64(string& b64Cert)
{
_publicKey->certToBase64(b64Cert);
}
void
IceSSL::RSAKeyPair::keyToByteSeq(ByteSeq& keySeq)
{
_privateKey->keyToByteSeq(keySeq);
}
void
IceSSL::RSAKeyPair::certToByteSeq(ByteSeq& certSeq)
{
_publicKey->certToByteSeq(certSeq);
}
RSA*
IceSSL::RSAKeyPair::getRSAPrivateKey() const
{
return _privateKey->get();
}
X509*
IceSSL::RSAKeyPair::getX509PublicKey() const
{
return _publicKey->getX509PublicKey();
}
IceSSL::RSAKeyPair::RSAKeyPair(const RSAPrivateKeyPtr& rsa, const RSAPublicKeyPtr& x509) :
_privateKey(rsa),
_publicKey(x509)
{
}
|